/* ── Scribe content pane (replaces nested <main> in show.html.erb) ── */

.scribe-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}


/* ── Channel card ────────────────────────────────────────────── */

.scribe-channel-card {
  border: 1px solid var(--color-border);
  background: var(--color-box);
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
}

.scribe-channel-card + .scribe-channel-card {
  border-top: none;
}

.scribe-channel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.scribe-channel-address-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-subtle, rgba(0,0,0,0.04));
  border: 1px solid var(--color-border);
  padding: 0.3rem 0.5rem;
  margin-bottom: 0.85rem;
}

.scribe-channel-address-text {
  flex: 1;
  font-family: var(--font-stack-monospace);
  font-size: 0.8rem;
  word-break: break-all;
  user-select: all;
}

.scribe-channel-copy-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 0.15rem 0.3rem;
  cursor: pointer;
  opacity: 0.45;
  font-size: 0.9rem;
  line-height: 1;
  min-height: auto;
  border-radius: 3px;
  transition: opacity 0.12s;
}

.scribe-channel-copy-btn:hover {
  opacity: 0.85;
  background: transparent;
  border: none;
}

.scribe-channel-rules {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.scribe-channel-rule {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}


.scribe-channel-rule-value {
  font-size: 0.875rem;
}

.scribe-channel-config-panel {
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.brainstorm-channel-editor {
  margin-top: 0.85rem;
}

.brainstorm-channel-editor > summary {
  list-style: none;
  cursor: pointer;
}

.brainstorm-channel-editor > summary::before,
.brainstorm-channel-editor > summary::-webkit-details-marker {
  display: none;
  content: none;
}

.brainstorm-channel-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.brainstorm-channel-form .field {
  flex: 1 1 240px;
  margin: 0;
}

/* ── New Task right pane ────────────────────────────────────── */

.task-new-pane {
  position: fixed;
  top: 51px; /* below main nav */
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.07);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.task-new-pane.is-open {
  transform: translateX(0);
}

.task-new-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--base-spacing) * 1.5);
  padding-bottom: var(--base-spacing);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.task-new-pane-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.task-new-pane-body {
  flex: 1;
  overflow-y: auto;
  padding: calc(var(--base-spacing) * 1.5);
}

.task-new-pane-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: var(--base-spacing) calc(var(--base-spacing) * 1.5);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.task-new-pane .field {
  margin-bottom: var(--base-spacing);
}

.task-pane-attach {
  margin-top: calc(var(--base-spacing) * 0.5);
  margin-bottom: var(--base-spacing);
}

.task-pane-attach > summary {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  opacity: 0.5;
  cursor: pointer;
  list-style: none;
  padding: 0;
  transition: opacity 0.15s;
}

.task-pane-attach > summary::before {
  display: none;
}

.task-pane-attach > summary:hover {
  opacity: 0.85;
}

@media (prefers-color-scheme: dark) {
  .task-new-pane {
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
  }
}

/* ── Chat full-width wrapper ────────────────────────────────── */

.scribe-chat-fullwidth {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.scribe-chat-fullwidth .scribe-chat-sidebar {
  max-height: none;
  position: static;
  flex: 1;
  min-height: 0;
}

/* ── Kanban filter bar ──────────────────────────────────────── */

.scribe-kanban-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.scribe-filter-tab {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-family: var(--font-stack-monospace);
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  opacity: 0.4;
  transition: opacity 0.12s;
}

.scribe-filter-tab:hover {
  opacity: 0.75;
  color: inherit;
  text-decoration: none;
}

.scribe-filter-tab.is-active {
  opacity: 1;
  font-weight: 600;
}

/* ── Kanban board ────────────────────────────────────────────── */

.scribe-kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  align-items: start;
}

@media (max-width: 900px) {
  .scribe-kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .scribe-kanban-board {
    grid-template-columns: 1fr;
  }
}

.scribe-kanban-col {
  border: 1px solid var(--color-border);
  background: var(--color-box);
}

.scribe-kanban-col.is-in-progress {
  border-color: var(--color-success);
}

.scribe-kanban-col.is-waiting {
  border-color: var(--color-warning);
}

.scribe-kanban-col-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.scribe-kanban-col-title {
  flex: 1;
}

.scribe-kanban-col-body {
  padding: 0.5rem;
  min-height: 60px;
}

.scribe-kanban-empty {
  padding: 1.5rem 0.75rem;
  text-align: center;
  opacity: 0.3;
  font-size: 0.8rem;
}

/* ── Task cards ──────────────────────────────────────────────── */

.scribe-task-card {
  display: block;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--color-border);
  background: var(--color-box);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}

.scribe-task-card:last-child {
  margin-bottom: 0;
}

.scribe-task-card:hover {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.015);
  color: inherit;
  text-decoration: none;
}

.scribe-task-card.is-in-progress {
  border-left: 3px solid var(--color-success);
}

.scribe-task-card.is-waiting {
  border-left: 3px solid var(--color-warning);
}

.scribe-task-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.35rem 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.scribe-task-card-summary {
  font-size: 0.75rem;
  opacity: 0.55;
  line-height: 1.5;
  margin: 0 0 0.5rem 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.scribe-task-card-footer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}


/* ── Chat sidebar ────────────────────────────────────────────── */

.scribe-chat-sidebar {
  border: 1px solid var(--color-border);
  background: var(--color-box);
  display: flex;
  flex-direction: column;
  max-height: 640px;
  position: sticky;
  top: 1rem;
}

.scribe-chat-header {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-stack-monospace);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.scribe-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scribe-chat-thread-empty {
  opacity: 0.4;
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem 0;
}

.scribe-chat-bubble-user {
  align-self: flex-end;
  background: var(--color-primary, #0a0a0a);
  color: #fff;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  max-width: 72%;
  line-height: 1.5;
  border-radius: 14px 14px 3px 14px;
}

.scribe-chat-bubble-user-text {
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
}

.scribe-chat-bubble-agent {
  align-self: flex-start;
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 88%;
  background: var(--surface-subtle, rgba(0,0,0,0.04));
  padding: 0.5rem 0.75rem;
  border-radius: 3px 14px 14px 14px;
}

.scribe-chat-bubble-agent .markdown-body {
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Cover both structures:
   1. <div class="scribe-chat-bubble-agent"><div class="markdown-body">…</div></div>  (chat_section)
   2. <div class="scribe-chat-bubble-agent markdown-body">…</div>                     (completed_turn) */
.scribe-chat-bubble-agent .markdown-body p,
.scribe-chat-bubble-agent.markdown-body p {
  margin-top: 0;
  margin-bottom: 0;
}

.scribe-chat-bubble-agent .markdown-body p + p,
.scribe-chat-bubble-agent.markdown-body p + p {
  margin-top: 0.5em;
}

.scribe-thinking-indicator {
  opacity: 0.5;
  font-size: 0.8rem;
}
.thinking-dots::after {
  content: '';
  animation: thinking-dots 1.5s steps(4, end) infinite;
}
@keyframes thinking-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ── Conversation history strip ──────────────────────────────── */

.scribe-conv-strip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.scribe-conv-strip::-webkit-scrollbar {
  display: none;
}

.scribe-conv-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-family: var(--font-stack-monospace);
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.12s;
  flex-shrink: 0;
  border-radius: 3px;
}

/* Hover for inactive pills — higher specificity to beat .sidebar-content a:hover */
.scribe-conv-strip a.scribe-conv-pill:not(.is-active):hover,
.scribe-chat-sidebar .scribe-conv-pill:not(.is-active):hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.14) !important;
  color: #1a1a1a !important;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .scribe-conv-strip a.scribe-conv-pill:not(.is-active):hover,
  .scribe-chat-sidebar .scribe-conv-pill:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.95) !important;
  }
}

.scribe-conv-pill.is-active,
.scribe-conv-pill.is-active:hover,
.scribe-conv-pill.is-active:focus,
.scribe-conv-pill.is-active:active {
  opacity: 1;
  background: var(--color-primary, #0a0a0a) !important;
  color: #fff !important;
  border-color: var(--color-primary, #0a0a0a) !important;
}

.scribe-conv-pill.is-active:hover {
  opacity: 0.85;
}

.scribe-conv-pill-new {
  border-style: dashed;
  opacity: 0.4;
  background: transparent;
}

.scribe-conv-pill-new:hover {
  opacity: 0.7;
}

/* ── Conversation list items ─────────────────────────────────── */

.scribe-conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.scribe-conv-item {
  display: block;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-box);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.scribe-conv-item:hover {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.015);
  color: inherit;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .scribe-conv-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
  }
}

.scribe-conv-item-preview {
  font-size: 0.8rem;
  line-height: 1.45;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scribe-conv-item-date {
  font-size: 0.7rem;
  opacity: 0.4;
  margin: 0.25rem 0 0;
}

/* ── Chat compose ────────────────────────────────────────────── */

.scribe-chat-compose {
  border-top: 1px solid var(--color-border);
  padding: 0.6rem;
  flex-shrink: 0;
}

/* ── Danger dropdown ─────────────────────────────────────────── */

.scribe-danger-dropdown {
  position: relative;
  display: inline-block;
}

.scribe-danger-dropdown > summary {
  list-style: none;
  display: block;
  cursor: pointer;
}

.scribe-danger-dropdown > summary::-webkit-details-marker {
  display: none;
}

.scribe-danger-dropdown > summary::marker {
  display: none;
  content: "";
}

.scribe-danger-dropdown > summary::before {
  display: none;
}

.scribe-danger-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-box);
  border: 1px solid var(--color-border);
  padding: 0.6rem;
  z-index: 200;
  min-width: 200px;
  box-shadow: var(--shadow-md);
}
