/* ════════════════════════════════════════════════════════════════════
   PLAYBOOKS — additive styles only.
   The builder modal reuses forms.css's .fb-* two-pane layout wholesale
   (same flow list / inspector pattern as Screening Forms) and the Chats
   "Agent" picker reuses literature-review.css's .ai-projscope-* pill +
   dropdown wholesale (same trigger/panel as the Projects scope picker).

   Genuinely new below: the divider inside the agent dropdown, the live
   Progress checklist (sidebar), the per-step disclosures that live INLINE
   on a Playbook's chat message (.pb-step-card — nested inside the existing
   .ai-thinking-steps "Steps (N)" disclosure from literature-review.css).
   Only the step's HEAD (badge + title) is boxed, as a click target; its
   output is deliberately unboxed and flows as plain text underneath,
   styled by the shared .ai-msg-content rules so it reads exactly like a
   normal chat answer. A step's "Send as email" action (only present when
   that output channel is enabled for the step — see .pb-output-option
   below) reuses literature-review.css's .ai-msg-actions/.ai-msg-action-btn
   wholesale, same as the message-level Copy/Export buttons. Also here:
   the builder inspector's Output selector (.pb-output-option, .pb-flow-
   chip-email — the matching chip on the step's flow card), and the
   generated-file cards in the sidebar's Outputs tab (.pb-file-card —
   actual Word/PowerPoint/Excel exports, or an email draft a person
   deliberately sent via a step's "Send as email" button).
   ════════════════════════════════════════════════════════════════════ */

.ai-agentpicker-divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}
.ai-projscope-item.active {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 600;
}
.ai-projscope-item.active i:first-child { color: var(--teal); }
.ai-projscope-item i.bx-check {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--teal);
  flex-shrink: 0;
}

.pb-progress-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pb-progress-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--ink-muted);
}
.pb-progress-step-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  border: 1.5px solid var(--border);
  position: relative;
}
.pb-progress-step-icon i {
  font-size: 10px;
  line-height: 1;
  color: #fff;
}
.pb-progress-step.done .pb-progress-step-icon {
  background: var(--teal);
  border-color: var(--teal);
}
.pb-progress-step.running { color: var(--ink); font-weight: 600; }
.pb-progress-step.running .pb-progress-step-icon { border-color: transparent; }
.pb-progress-step.running .pb-progress-step-icon::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--teal);
  border-right-color: var(--teal);
  animation: pbSpin 0.7s linear infinite;
}
.pb-progress-step-text { flex: 1; word-break: break-word; }

@keyframes pbSpin { to { transform: rotate(360deg); } }

/* ── Step "Output" selector — builder inspector (.pb-output-option) and
   its matching flow-card chip (.pb-flow-chip-email). Flags a step's
   answer as sendable via a channel once the playbook runs; email is the
   only channel today. .fb-flow-chip is forms.css's base pill (shared
   with the existing "Free text" chip) — the modifier below only touches
   colour, not layout, matching the pattern .ai-projscope-item.active
   already uses elsewhere in this file. ── */
.fb-flow-chip.pb-flow-chip-email {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: var(--border-teal);
}

.pb-output-options { display: flex; flex-wrap: wrap; gap: 8px; }
.pb-output-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-page);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.pb-output-option:hover { border-color: var(--border-hover); color: var(--ink); }
.pb-output-option.active {
  background: var(--teal-soft);
  border-color: var(--border-teal);
  color: var(--teal);
}
.pb-output-option-check { margin-left: 2px; font-size: 0.85rem; }

/* Each step is a boxed, clickable head — the disclosure trigger — with its
   output flowing as plain, unboxed text underneath once expanded. The box
   marks "this is a distinct step"; it deliberately does NOT extend around
   the output, so the output reads like a normal answer, not like content
   trapped in a nested card. */
/* .ai-thinking-steps.visible (literature-review.css) carries a gap:4px
   rule at higher specificity (two classes) than a bare .pb-steps-list
   selector, so it would silently win over a plain override — the
   compound selector below matches exactly what's on the element and
   wins cleanly. */
.ai-thinking-steps.visible.pb-steps-list { gap: 10px; }
.pb-step-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-page);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  user-select: none;
  transition: background 0.15s;
}
.pb-step-card-head:hover { background: var(--bg-elevated); }
.pb-step-card-head .bx-chevron-down { transition: transform 0.15s; margin-left: auto; color: var(--ink-muted); flex-shrink: 0; }
.pb-step-card.expanded .pb-step-card-head .bx-chevron-down { transform: rotate(180deg); }
.pb-step-card-badge {
  flex-shrink: 0;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.6rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.pb-step-card-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.pb-step-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.22s ease;
}
.pb-step-card.expanded .pb-step-card-body {
  max-height: 20000px;
}
/* No border, no background, no card padding here — this is the "just text
   below the step" requirement. Left padding echoes the head's own 9px
   inset so the output's left edge lines up under the badge, and the
   .ai-msg-content rules (literature-review.css) own all paragraph / list /
   heading spacing, so a step's output is typographically identical to a
   normal chat answer. */
.pb-step-card-body-inner {
  padding: 12px 4px 2px 9px;
}

/* ── Generated-file / email-draft cards — Outputs tab (right sidebar).
   Actual downloadable files (Word/PowerPoint/Excel) a Playbook or chat
   turn has produced, plus email drafts sent via a step's "Send as email"
   button — never an automatic copy of step text, which lives inline on
   the message itself (.pb-step-card above) unless deliberately sent
   here. Plain rows, not collapsible — there's nothing to expand; the
   whole card is the click target that opens/downloads it, so there's no
   separate trailing button repeating the card's own icon. ── */
.pb-file-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.pb-file-card:hover { background: var(--bg-elevated); border-color: var(--border-hover); }
.pb-file-card-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--teal-soft);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}
.pb-file-card-body {
  flex: 1;
  min-width: 0;
}
.pb-file-card-name {
  display: block; /* required for text-overflow:ellipsis to take effect —
    on a bare inline <span> (the default) there's no box to truncate
    against, so a long subject like "Concise into an email message to
    send..." just overflows the card instead of clipping with an ellipsis */
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}