:root {
  --bg: #faf8f4;
  --panel: #ffffff;
  --panel-2: #f3efe8;
  --border: #e6e0d4;
  --ink: #2a2723;
  --ink-soft: #6b6358;
  --ink-faint: #9a9286;
  --sage: #6b8f71;
  --sage-soft: #e3ecdf;
  --ember: #c97a3f;
  --ember-soft: #f7e6d6;
  --warn: #b8893a;
  --ok: #6b8f71;
  --info: #4a7a8c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: 56px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
  position: relative;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 1px;
}
.brand-mark::before {
  width: 3px;
  height: 12px;
  left: 7px;
  top: 7px;
  background: var(--ember);
}
.brand-mark::after {
  width: 3px;
  height: 16px;
  left: 13px;
  top: 5px;
  background: var(--sage);
}
.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-product {
  font-size: 13px;
  color: var(--ink-faint);
  margin-left: -4px;
}
.brand-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}
.session-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.session-title {
  font-weight: 600;
  font-size: 14px;
}
.session-sub {
  color: var(--ink-faint);
  font-size: 12px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.presence {
  display: flex;
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 11px;
  margin-left: -6px;
}
.avatar:first-child {
  margin-left: 0;
}
.avatar.you {
  background: var(--sage);
}
.avatar.them {
  background: var(--ember);
}
.conn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.18);
}
.dot.disconnected {
  background: var(--ink-faint);
  box-shadow: 0 0 0 3px rgba(154, 146, 134, 0.18);
}

/* Stage strip */
.stage-strip {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 40px;
}
.stage-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 100%;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.stage-tab:hover {
  color: var(--ink);
}
.stage-tab.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--sage);
}
.stage-tab.disabled {
  color: var(--ink-faint);
  cursor: pointer;
}
.stage-tab .stage-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--ink-faint);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.stage-tab.active .stage-num {
  background: var(--sage);
  color: white;
}
.stage-tab .stage-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stage-tab.disabled .stage-status {
  background: var(--panel-2);
  color: var(--ink-faint);
}
.stage-arrow {
  color: var(--ink-faint);
  font-size: 11px;
  padding: 0 4px;
}

/* Layout */
.app {
  display: grid;
  grid-template-columns: var(--left-pane-w, 280px) 1fr var(--right-pane-w, 320px);
  height: calc(100vh - 96px);
  transition: grid-template-columns 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.app.left-collapsed {
  --left-pane-w: 36px;
}
.app.right-collapsed {
  --right-pane-w: 36px;
}
.pane {
  position: relative;
  background: var(--panel);
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.pane:last-child {
  border-right: none;
  border-left: 1px solid var(--border);
}
.pane.collapsed {
  overflow: hidden;
}
.pane.collapsed > *:not(.pane-toggle) {
  display: none;
}

/* Sidebar collapse toggles — small floating chevron buttons, always visible */
.pane-toggle {
  position: absolute;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  /* Stays above the sticky `.pane-header` so the chevron is always clickable. */
  z-index: 3;
  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
}
.pane-toggle:hover {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--ink-faint);
}
.pane-toggle--left {
  right: 6px;
}
.pane-toggle--right {
  left: 6px;
}
.pane-toggle-icon {
  display: inline-block;
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* When the pane is collapsed, flip the chevron and re-center the button so
   it sits in the middle of the narrow strip rather than the corner. */
.pane.collapsed .pane-toggle {
  top: 50%;
  right: auto;
  left: 50%;
  transform: translate(-50%, -50%);
}
.pane.collapsed .pane-toggle-icon {
  transform: rotate(180deg);
}
.pane-header {
  padding: 12px 16px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
/* Reserve room for the floating sidebar toggle so header text never sits
   underneath the chevron. Left pane chevron is on the right; right pane on
   the left. */
#left-pane .pane-header {
  padding-right: 38px;
}
#right-pane .pane-header {
  padding-left: 38px;
}
#left-pane .project-context {
  padding-right: 38px;
}
.pane-header--no-top {
  border-top: 0;
}

.project-context {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12px;
}
.project-context-label {
  color: var(--ink-faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.project-context-value {
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--ink);
  font-size: 11.5px;
}

.group {
  padding: 4px 0 8px;
}
.group-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13px;
}
.file:hover {
  background: var(--panel-2);
}
.file.active {
  background: var(--sage-soft);
  border-left-color: var(--sage);
}
.file-icon {
  font-size: 13px;
  opacity: 0.7;
  width: 14px;
}
.file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-draft {
  background: #f1ece2;
  color: var(--warn);
}
.status-reviewed {
  background: #e6eef2;
  color: var(--info);
}
.status-approved {
  background: var(--sage-soft);
  color: var(--sage);
}
.editing-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 3px rgba(201, 122, 63, 0.2);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Editor pane */
.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.editor-pane.hidden {
  display: none;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.editor-path {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
}
.editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.save-state {
  font-size: 12px;
  color: var(--ink-faint);
}
.save-state.saving {
  color: var(--ember);
}
.save-state.saved {
  color: var(--ok);
}
.btn {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}
.btn:hover {
  background: var(--panel-2);
}
.btn.primary {
  background: var(--sage);
  color: white;
  border-color: var(--sage);
}
.btn.primary:hover {
  background: #5a7a60;
}
.btn--flash {
  background: var(--sage-soft);
  border-color: var(--sage);
  color: var(--sage);
  transition:
    background 120ms ease,
    color 120ms ease;
}
.btn:disabled,
.btn.primary:disabled {
  cursor: default;
  opacity: 0.7;
}
.btn.primary.approved,
.btn.primary.approved:hover {
  background: var(--sage-soft);
  color: var(--sage);
  border-color: var(--sage-soft);
}
.btn--icon {
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
  color: var(--ink-soft);
}
.btn--icon.active {
  background: var(--sage-soft);
  border-color: var(--sage);
  color: var(--sage);
}

/* Owner-only "Switch project" button in the topbar */
.switch-btn {
  font-size: 12px;
  padding: 3px 10px;
  color: var(--ink-soft);
}
.switch-btn.hidden {
  display: none;
}

.editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.editor-body.preview-only {
  grid-template-columns: 1fr;
}
.editor-body.preview-only .editor {
  display: none;
}
.editor,
.preview {
  overflow-y: auto;
  padding: 24px 28px;
  font-size: 14px;
  line-height: 1.6;
}
.editor {
  border-right: 1px solid var(--border);
  background: var(--panel);
  font-family: ui-monospace, "SF Mono", "Menlo", monospace;
  font-size: 13px;
}
.editor textarea {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.6;
  background: transparent;
  color: var(--ink);
}
.preview {
  background: var(--bg);
}
.preview h1 {
  font-size: 22px;
  margin-top: 0;
}
.preview h2 {
  font-size: 17px;
  margin-top: 24px;
  color: var(--ink);
}
.preview code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px;
}
.preview ul {
  padding-left: 22px;
}
.frontmatter {
  background: var(--panel-2);
  border: 1px dashed var(--border);
  padding: 10px 14px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.app.hidden,
.stage-strip.hidden {
  display: none;
}

/* Setup / empty-state pane */
.setup-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  background: var(--bg);
  min-height: calc(100vh - 96px);
  overflow-y: auto;
}
.setup-pane.hidden {
  display: none;
}
.setup-card {
  width: 100%;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}
.setup-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.setup-row.current {
  border-style: solid;
  border-color: var(--sage);
  background: var(--sage-soft);
}
.setup-current-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--sage);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.setup-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
}
.setup-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.setup-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 600;
  margin: 18px 0 8px;
}
.setup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px dashed var(--border);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
}
.setup-row-main {
  flex: 1;
  min-width: 0;
}
.setup-row-name {
  font-weight: 600;
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.setup-row-meta {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.setup-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}
.setup-empty {
  font-size: 12.5px;
  color: var(--ink-faint);
  font-style: italic;
  padding: 8px 0;
}
.setup-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.setup-form label {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  color: var(--ink-soft);
  gap: 4px;
}
.setup-form label.full {
  grid-column: 1 / -1;
}
.setup-form input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  background: var(--panel);
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--ink);
}
.setup-form input:focus {
  outline: 2px solid var(--sage-soft);
  border-color: var(--sage);
}
.setup-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.setup-error {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ember-soft);
  color: var(--ember);
  font-size: 12.5px;
}
.setup-error.hidden {
  display: none;
}
.setup-done {
  text-align: center;
  font-size: 14px;
  color: var(--sage);
  padding: 24px 0;
}

.browse {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 10px 12px;
}
.browse-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.browse-breadcrumbs {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  overflow-x: auto;
  white-space: nowrap;
}
.browse-crumb {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
}
.browse-crumb:hover {
  background: var(--panel);
  color: var(--ink);
}
.browse-crumb-sep {
  color: var(--ink-faint);
  padding: 0 1px;
}
.browse-hidden {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.browse-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
}
.browse-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.browse-row:hover {
  background: var(--panel-2);
}
.browse-icon {
  font-size: 14px;
}
.browse-name {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12.5px;
}
.browse-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.browse-current {
  flex: 1;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editing-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--ember-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ember);
}
.editing-banner.hidden {
  display: none;
}

/* Placeholder pane for inactive stages */
.placeholder-pane {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
  text-align: center;
}
.placeholder-pane.active {
  display: flex;
}
.placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  font-size: 26px;
}
.placeholder-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.placeholder-text {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 380px;
  line-height: 1.55;
}
.placeholder-soon {
  margin-top: 16px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Right pane */
.progress-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  background: var(--panel-2);
  padding: 10px;
  border-radius: 6px;
}
.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}
.stat-label {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child {
  border-bottom: none;
}
.activity-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  flex-shrink: 0;
  font-weight: 600;
}
.activity-icon.agent {
  background: var(--sage-soft);
  color: var(--sage);
}
.activity-icon.you {
  background: #e3eef5;
  color: var(--info);
}
.activity-icon.them {
  background: var(--ember-soft);
  color: var(--ember);
}
.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-text {
  font-size: 12.5px;
  color: var(--ink);
}
.activity-text strong {
  font-weight: 600;
}
.activity-meta {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.agent-running {
  margin: 12px 16px;
  padding: 12px;
  background: var(--sage-soft);
  border-radius: 6px;
  font-size: 13px;
}
.agent-running-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--sage);
  margin-bottom: 4px;
}
.agent-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--sage);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.agent-heartbeat {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.heartbeat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage);
  animation: pulse 1.6s infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Share via Tailscale (ADR-018) */
.share-anchor {
  position: relative;
  display: inline-block;
}
.share-pane {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.share-pane.hidden {
  display: none;
}
.share-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.share-status {
  font-size: 13px;
  color: var(--ink);
}
.share-banner {
  background: var(--ember-soft);
  color: var(--ember);
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 6px;
}
.share-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.share-row-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  gap: 8px;
}
.share-row-body {
  display: flex;
  align-items: center;
  gap: 6px;
}
.share-row-hint {
  font-size: 11.5px;
  color: var(--ink-faint);
}
.share-url {
  flex: 1;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.share-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 4px;
}
.share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}
.share-empty {
  font-size: 12.5px;
  color: var(--ink-faint);
  font-style: italic;
}
.share-error {
  font-size: 12px;
  color: var(--ember);
  background: var(--ember-soft);
  padding: 6px 10px;
  border-radius: 6px;
}
.share-link-err {
  font-size: 11.5px;
  color: var(--ember);
  background: var(--ember-soft);
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.btn-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ember);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}

/* Login pane (ADR-019) */
.login-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 96px 24px 24px;
  background: var(--bg);
  min-height: calc(100vh - 96px);
}
.login-pane.hidden {
  display: none;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}
.login-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}
.login-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  color: var(--ink-soft);
  gap: 4px;
}
.login-form input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--panel);
  color: var(--ink);
}
.login-form input:focus {
  outline: 2px solid var(--sage-soft);
  border-color: var(--sage);
}
.login-form button {
  margin-top: 6px;
}
.login-error {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ember-soft);
  color: var(--ember);
  font-size: 12.5px;
}
.login-error.hidden {
  display: none;
}

/* Funnel tag — public exposure */
.share-tag--warn {
  background: var(--ember-soft);
  color: var(--ember);
}

/* Coworkers section in share pane */
.cowo-section {
  flex-direction: column;
  gap: 8px;
}
.cowo-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cowo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  background: var(--panel);
  border-radius: 6px;
}
.cowo-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ember);
  color: white;
  font-weight: 600;
  font-size: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cowo-meta {
  flex: 1;
  min-width: 0;
}
.cowo-username {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
}
.cowo-since {
  font-size: 11px;
  color: var(--ink-faint);
}
.btn-icon {
  background: transparent;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--ink-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.btn-icon:hover {
  background: var(--ember-soft);
  color: var(--ember);
}
.cowo-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
}
.cowo-confirm-yes {
  color: var(--ember);
}
.cowo-add-btn {
  font-size: 12.5px;
  align-self: flex-start;
}
.cowo-add-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
}
.cowo-add-form input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  background: var(--panel);
  color: var(--ink);
}
.cowo-add-error {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--ember);
}
.cowo-credential {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--sage-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.cowo-credential-label {
  font-size: 11.5px;
  color: var(--sage);
  font-weight: 600;
}
.cowo-credential-field {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--ink-soft);
  gap: 2px;
}
.cowo-credential-field input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12.5px;
  background: var(--panel);
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--ink);
}
.cowo-credential-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.share-anchor .btn.hidden {
  display: none;
}

/* Stage-aware sidebar content blocks */
.stage-content.hidden {
  display: none;
}

.impl-view-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: var(--panel-2);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Implement: empty state inside the center preview pane.
   When the preview only contains the empty state, it centers like the
   placeholder-pane; once a real summary renders the class is removed and the
   preview returns to its normal scrollable layout. */
.preview.impl-preview.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.impl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 380px;
}
.impl-empty .placeholder-text code {
  background: var(--panel-2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}

/* Implement: execution-status panel (right pane) */
.execution-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.execution-empty {
  font-size: 12px;
  color: var(--ink-faint);
  padding: 12px 0;
  line-height: 1.5;
}
.execution-empty code {
  background: var(--panel-2);
  padding: 1px 4px;
  border-radius: 3px;
}
.execution-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.execution-phase {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.execution-status-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
}
.execution-status--complete {
  background: var(--sage-soft);
  color: var(--sage);
}
.execution-status--paused {
  background: #fbe9d2;
  color: #8a5a1f;
}
.execution-status--running {
  background: #e0eaff;
  color: #3a4f8a;
}
.execution-checkpoint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: auto;
}
.execution-current-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 10px;
}
.execution-current-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  font-weight: 600;
}
.execution-current-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 3px;
}
.execution-current-title {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.4;
}
.execution-current-meta {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 6px;
}
.execution-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.execution-stat {
  background: var(--panel-2);
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.execution-stat-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.execution-stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* Inspect tab — story rows in the sidebar */
.inspect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  margin: 0 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}
.inspect-row:hover {
  background: var(--panel-2);
}
.inspect-row.active {
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 600;
}
.inspect-row-id {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.inspect-row-id-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inspect-row-badges {
  display: inline-flex;
  gap: 4px;
}
.rework-cycle-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fef7ee;
  color: #b04a1a;
  border: 1px solid #fbe4d2;
  white-space: nowrap;
}
.inspect-head-id-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.inspect-head-rework {
  font-size: 11.5px;
  color: #b04a1a;
  font-weight: 500;
}
.rework-history-note {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.4;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 6px;
}
.rework-history-num {
  font-weight: 700;
  color: #b04a1a;
  margin-right: 2px;
}

/* Verdict pills — used in sidebar, header, and per-card */
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
}
.verdict--small {
  font-size: 10px;
  padding: 2px 6px;
}
.verdict--pass {
  background: var(--sage-soft);
  color: var(--sage);
}
.verdict--rework {
  background: #fbe4d2;
  color: #b04a1a;
}
.verdict--missing {
  background: var(--panel-2);
  color: var(--ink-faint);
}
.verdict--unknown {
  background: #fdf3d0;
  color: #8a6a1f;
}

/* Inspect center pane — uses .editor-pane shell, but the body lays out
   side-by-side review cards instead of a textarea/preview pair. */
.inspect-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 18px 24px;
  background: var(--bg);
  gap: 14px;
}
.inspect-body--empty {
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.inspect-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.inspect-head-id {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.inspect-head-verdicts {
  display: inline-flex;
  gap: 8px;
}
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
@media (max-width: 1100px) {
  .review-grid {
    grid-template-columns: 1fr;
  }
}
.review-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-height: 0;
}
.review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.review-card-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.review-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.review-meta-pill {
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--panel-2);
  padding: 2px 8px;
  border-radius: 999px;
}
.review-card-body {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  overflow-y: auto;
  flex: 1;
}
.review-card-body h1,
.review-card-body h2,
.review-card-body h3 {
  font-size: 14px;
  margin: 16px 0 6px;
  color: var(--ink);
}
.review-card-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}
.review-card-body th,
.review-card-body td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
}
.review-card-body code {
  background: var(--panel-2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}
.review-card-empty {
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
}
.review-card-loading {
  padding: 16px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* Inspect right-pane summary */
.execution-stat.stat--pass .execution-stat-num {
  color: var(--sage);
}
.execution-stat.stat--rework .execution-stat-num {
  color: #b04a1a;
}
.rework-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rework-list-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 4px;
}
.rework-list-item {
  text-align: left;
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid #fbe4d2;
  background: #fef7ee;
  color: #b04a1a;
  border-radius: 6px;
  cursor: pointer;
}
.rework-list-item:hover {
  background: #fbe4d2;
}

/* Kickoff status panel (right pane summary) */
.kickoff-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.kickoff-section.hidden {
  display: none;
}
.kickoff-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
}
.kickoff-status-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
}
.kickoff-status--complete {
  background: var(--sage-soft);
  color: var(--sage);
}
.kickoff-status--paused {
  background: #fbe9d2;
  color: #8a5a1f;
}
.kickoff-status--running {
  background: #e0eaff;
  color: #3a4f8a;
}
.kickoff-checkpoint {
  font-size: 11px;
  color: var(--ink-faint);
}
.kickoff-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kickoff-step {
  display: grid;
  grid-template-columns: 18px 56px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.kickoff-step.done .kickoff-step-marker {
  color: var(--sage);
}
.kickoff-step.done .kickoff-step-title,
.kickoff-step.done .kickoff-step-num {
  color: var(--ink-faint);
}
.kickoff-step.current {
  color: var(--ink);
  font-weight: 600;
}
.kickoff-step.current .kickoff-step-marker {
  color: #c08a2a;
}
.kickoff-step-marker {
  text-align: center;
  font-weight: 700;
}
.kickoff-step-num {
  color: inherit;
}
.kickoff-step-title {
  color: inherit;
}

/* Session-log structured view (collapsible rounds + categories) */
.session-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.session-log-intro {
  color: var(--ink-soft);
  font-size: 13px;
}
.session-log-round {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.session-log-round[open] {
  background: var(--panel-2);
}
.session-log-round-title {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--ink);
  font-size: 13.5px;
  list-style: none;
  user-select: none;
}
.session-log-round-title::-webkit-details-marker {
  display: none;
}
.session-log-round-title::before {
  content: "▸ ";
  color: var(--sage);
  display: inline-block;
  width: 14px;
}
.session-log-round[open] > .session-log-round-title::before {
  content: "▾ ";
}
.session-log-round-body {
  padding: 0 14px 4px 28px;
  font-size: 13px;
  color: var(--ink-soft);
}
.session-log-category {
  margin: 4px 14px 10px 28px;
  border-left: 2px solid var(--sage-soft);
  padding-left: 10px;
}
.session-log-category-title {
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--sage);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  list-style: none;
  user-select: none;
  padding: 4px 0;
}
.session-log-category-title::-webkit-details-marker {
  display: none;
}
.session-log-category-title::before {
  content: "▸ ";
  display: inline-block;
  width: 14px;
}
.session-log-category[open] > .session-log-category-title::before {
  content: "▾ ";
}
.session-log-category-body {
  font-size: 13px;
  color: var(--ink);
  padding: 2px 0 6px;
}
.session-log-category-body ul,
.session-log-round-body ul {
  margin: 4px 0;
  padding-left: 20px;
}
