/* Workflow Builder — visual branch editor styles */

/* Settings row — collapsed name + expandable config */
.settings-row {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.settings-row-summary {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  user-select: none;
}

.settings-row-summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

.settings-row-name {
  font-size: 0.85rem;
}

.settings-row-toggle {
  font-size: 0.75rem;
}

.settings-row-config {
  padding: 0.5rem 0.75rem 0.6rem;
  border-top: 1px solid var(--bs-border-color);
}

/* Trigger row — collapsed summary + expandable config */
.trigger-row {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.trigger-row-summary {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  user-select: none;
}

.trigger-row-summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

.trigger-row-icon {
  color: var(--bs-primary);
  font-size: 0.9rem;
}

.trigger-row-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.trigger-row-detail {
  font-size: 0.8rem;
}

.trigger-row-toggle {
  font-size: 0.75rem;
}

.trigger-row-config {
  padding: 0 0.75rem 0.6rem;
  border-top: 1px solid var(--bs-border-color);
}

.trigger-filters-panel {
  padding: 0.5rem 0.6rem;
  background: var(--bs-body-bg, #fff);
  border-radius: 0.375rem;
  border: 1px solid var(--bs-border-color);
}

.trigger-type-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--bs-border-color);
  background: transparent;
  color: var(--bs-body-color);
  transition: all 0.15s ease;
  user-select: none;
}

.trigger-type-option input[type="radio"] {
  display: none;
}

.trigger-type-option:hover {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.trigger-type-option.active {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

/* Action catalogue sidebar */
.action-catalogue-sidebar {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: 0.5rem;
}

.action-catalogue-search {
  padding-bottom: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 1;
}

.action-catalogue-list {
  flex: 1;
  overflow-y: auto;
}

.catalogue-category-header {
  font-size: 0.65em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary);
  padding: 0.4rem 0.25rem 0.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}

.catalogue-category-header:hover {
  color: var(--bs-body-color);
}

.catalogue-category-header .chevron {
  font-size: 0.6em;
  transition: transform 0.15s;
}

.catalogue-category-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.catalogue-category-body.collapsed {
  display: none;
}

.catalogue-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 0.25rem;
  cursor: grab;
  font-size: 0.82rem;
  user-select: none;
  transition: background 0.1s;
}

.catalogue-item:hover {
  background: rgba(var(--bs-primary-rgb), 0.08);
}

.catalogue-item:active {
  cursor: grabbing;
}

.catalogue-item-icon {
  font-size: 0.9rem;
  color: var(--bs-secondary);
  flex-shrink: 0;
}

.catalogue-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action card drag state */
.action-card[draggable="true"] {
  cursor: grab;
}

.action-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

/* Drop indicator */
.drop-indicator {
  height: 2px;
  background: var(--bs-primary);
  border-radius: 1px;
  margin: 2px 0;
  pointer-events: none;
}

.drop-target-highlight {
  outline: 2px dashed var(--bs-primary);
  outline-offset: -2px;
  border-radius: 0.375rem;
}

/* Split-panel layout in fullscreen modal */
.workflow-settings-panel {
  border-right: 1px solid var(--bs-border-color);
  padding-right: 1rem;
}

.workflow-builder-panel {
  display: flex;
  flex-direction: column;
}

.workflow-builder-panel #action-builder {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.workflow-builder-panel #action-list {
  flex: 1;
  overflow-y: auto;
}

/* Branch containers for condition actions */
.condition-branches {
  border-top: 1px solid var(--bs-border-color);
  padding-top: 0.75rem;
}

.condition-branch {
  border-radius: 0.375rem;
  padding: 0.5rem;
  min-height: 60px;
}

.condition-branch.branch-then {
  background: rgba(25, 135, 84, 0.05);
  border: 1px solid rgba(25, 135, 84, 0.2);
  border-left: 3px solid rgba(25, 135, 84, 0.5);
}

.condition-branch.branch-else {
  background: rgba(108, 117, 125, 0.05);
  border: 1px solid rgba(108, 117, 125, 0.2);
  border-left: 3px solid rgba(108, 117, 125, 0.4);
}

.condition-branch.branch-loop {
  background: rgba(13, 110, 253, 0.05);
  border: 1px solid rgba(13, 110, 253, 0.2);
  border-left: 3px solid rgba(13, 110, 253, 0.4);
}

.branch-loop .branch-header span {
  color: var(--bs-primary);
}

.branch-header {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 0.5rem;
}

.branch-then .branch-header span {
  color: var(--bs-success);
}

.branch-else .branch-header span {
  color: var(--bs-secondary);
}

/* Nested action cards within branches */
.condition-branch .action-card {
  border-color: rgba(0, 0, 0, 0.1);
}

.condition-branch .action-card .card-header {
  padding: 0.35rem 0.5rem;
  font-size: 0.85em;
}

.condition-branch .action-card .card-body {
  padding: 0.35rem 0.5rem;
}

/* Deeply nested branches get progressively more compact */
.condition-branch .condition-branch {
  font-size: 0.95em;
}

.condition-branch .condition-branch .condition-branch {
  font-size: 0.92em;
}

/* Branch action list — generous drop target area */
.branch-action-list {
  min-height: 48px;
  border-radius: 0.25rem;
  transition: background 0.15s, outline 0.15s;
}

.branch-action-list.drag-over {
  outline: 2px dashed var(--bs-primary);
  outline-offset: -2px;
  background: rgba(var(--bs-primary-rgb), 0.04);
}

.branch-action-list .text-muted {
  font-size: 0.8em;
  padding: 0.5rem !important;
}

/* Action type dropdown z-index fix for nested contexts */
.action-type-dropdown {
  z-index: 1055 !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Fullscreen modal body adjustments */
.modal-fullscreen .modal-body {
  padding: 1rem;
  overflow: hidden;
}

.modal-fullscreen .modal-body > form {
  height: 100%;
}

/* Template variable autocomplete dropdown */
.template-autocomplete {
  position: absolute;
  z-index: 10600;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  max-height: 260px;
  overflow-y: auto;
  min-width: 260px;
  max-width: 380px;
  padding: 0.25rem 0;
}

.template-autocomplete-category {
  padding: 0.3rem 0.75rem 0.15rem;
  font-size: 0.65em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary, #6c757d);
  pointer-events: none;
}

.template-autocomplete-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.85em;
  line-height: 1.4;
}

.template-autocomplete-item:hover,
.template-autocomplete-item.active {
  background: var(--bs-primary, #0d6efd);
  color: #fff;
}

.template-autocomplete-item:hover .template-autocomplete-desc,
.template-autocomplete-item.active .template-autocomplete-desc {
  color: rgba(255, 255, 255, 0.75);
}

.template-autocomplete-var {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  white-space: nowrap;
}

.template-autocomplete-desc {
  color: var(--bs-secondary, #6c757d);
  font-size: 0.85em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Workflow Chat Panel — collapsible right-side assistant panel
   ============================================================ */

/* Panel container */
.workflow-chat-panel {
  width: 380px;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bs-body-bg, #fff);
  border-left: 1px solid var(--bs-border-color);
  position: relative;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease, border-width 0.3s ease;
  flex-shrink: 0;
}

.workflow-chat-panel.collapsed {
  width: 0;
  min-width: 0;
  border-left-width: 0;
  overflow: hidden;
}

/* Toggle button — floating tab on the right edge of the builder panel */
.workflow-chat-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 10;
  width: 28px;
  height: 72px;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  border: none;
  border-radius: 0.375rem 0 0 0.375rem;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, right 0.2s ease;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0;
  line-height: 1;
}

.workflow-chat-toggle:hover {
  background: var(--bs-primary-text-emphasis, #0a58ca);
}

.workflow-chat-toggle i {
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.workflow-chat-toggle .toggle-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Header */
.workflow-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg, #fff);
  flex-shrink: 0;
  min-height: 48px;
}

.workflow-chat-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--bs-body-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workflow-chat-header-title i {
  color: var(--bs-primary, #0d6efd);
  font-size: 1rem;
  flex-shrink: 0;
}

.workflow-chat-header-close {
  background: transparent;
  border: none;
  color: var(--bs-body-color);
  opacity: 0.5;
  padding: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: opacity 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.workflow-chat-header-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

/* Messages area */
.workflow-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

/* Individual message bubbles */
.workflow-chat-message {
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
  animation: wfChatFadeIn 0.25s ease;
}

@keyframes wfChatFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* User messages — right-aligned */
.workflow-chat-message.user {
  flex-direction: row-reverse;
}

.workflow-chat-message.user .workflow-chat-bubble {
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  border-radius: 0.875rem 0.875rem 0.25rem 0.875rem;
  margin-left: 2rem;
}

/* Assistant messages — left-aligned */
.workflow-chat-message.assistant .workflow-chat-bubble {
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-body-color);
  border-radius: 0.875rem 0.875rem 0.875rem 0.25rem;
  margin-right: 2rem;
}

.workflow-chat-bubble {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.workflow-chat-bubble p {
  margin: 0;
}

.workflow-chat-bubble p + p {
  margin-top: 0.375rem;
}

/* Code blocks in assistant messages */
.workflow-chat-bubble code {
  font-size: 0.8em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.125rem 0.3rem;
  border-radius: 0.2rem;
}

.workflow-chat-message.user .workflow-chat-bubble code {
  background: rgba(255, 255, 255, 0.2);
}

.workflow-chat-bubble pre {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 0.5rem;
  margin: 0.375rem 0 0;
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.4;
}

.workflow-chat-bubble pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Collapsible workflow changes JSON block */
.wf-chat-changes-json {
  margin: 0.375rem 0;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  overflow: hidden;
}

.wf-chat-changes-json summary {
  padding: 0.375rem 0.625rem;
  font-size: 0.78rem;
  color: var(--bs-secondary-color, #6c757d);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bs-tertiary-bg, #f8f9fa);
}

.wf-chat-changes-json summary:hover {
  color: var(--bs-body-color);
}

.wf-chat-changes-json summary i {
  font-size: 0.75rem;
}

.wf-chat-changes-json pre {
  margin: 0;
  border: none;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0;
  max-height: 300px;
  overflow-y: auto;
}

/* Message avatar (optional small icon) */
.workflow-chat-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.workflow-chat-message.assistant .workflow-chat-avatar {
  background: var(--bs-primary, #0d6efd);
  color: #fff;
}

.workflow-chat-message.user .workflow-chat-avatar {
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-secondary, #6c757d);
}

/* Message timestamp */
.workflow-chat-message-time {
  font-size: 0.675rem;
  color: var(--bs-secondary, #6c757d);
  margin-top: 0.2rem;
  padding: 0 0.25rem;
}

.workflow-chat-message.user .workflow-chat-message-time {
  text-align: right;
}

/* Quick-start suggestion chips */
.workflow-chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.workflow-chat-starter {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.625rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color);
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.workflow-chat-starter:hover {
  border-color: var(--bs-primary, #0d6efd);
  color: var(--bs-primary, #0d6efd);
  background: rgba(var(--bs-primary-rgb), 0.04);
  transform: translateY(-1px);
}

.workflow-chat-starter:active {
  transform: translateY(0);
}

.workflow-chat-starter i {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Thinking / loading indicator */
.workflow-chat-thinking {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--bs-secondary, #6c757d);
  animation: wfChatFadeIn 0.25s ease;
}

.workflow-chat-thinking-dots {
  display: inline-flex;
  gap: 3px;
}

.workflow-chat-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bs-secondary, #6c757d);
  animation: wfChatDotBounce 1.4s ease-in-out infinite;
}

.workflow-chat-thinking-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.workflow-chat-thinking-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes wfChatDotBounce {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.workflow-chat-thinking-label {
  font-style: italic;
}

/* Changes-applied toast */
.workflow-chat-changes-applied {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  margin: 0.25rem 0.75rem;
  background: var(--bs-success-bg-subtle, #d1e7dd);
  color: var(--bs-success-text-emphasis, #0a3622);
  border: 1px solid var(--bs-success-border-subtle, #a3cfbb);
  border-radius: 0.375rem;
  font-size: 0.78rem;
  font-weight: 500;
  animation: wfChatToastIn 0.3s ease, wfChatToastOut 0.3s ease 3.7s forwards;
}

.workflow-chat-changes-applied i {
  font-size: 0.875rem;
  flex-shrink: 0;
}

@keyframes wfChatToastIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wfChatToastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* Input area */
.workflow-chat-input-area {
  padding: 0.625rem 0.75rem;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg, #fff);
  flex-shrink: 0;
}

.workflow-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.workflow-chat-input-area textarea {
  flex: 1;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 1rem;
  padding: 0.4rem 0.75rem;
  resize: none;
  font-size: 0.85rem;
  line-height: 1.45;
  max-height: 100px;
  overflow-y: auto;
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color);
  transition: border-color 0.15s ease;
}

.workflow-chat-input-area textarea:focus {
  outline: none;
  border-color: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.15);
}

.workflow-chat-input-area textarea::placeholder {
  color: var(--bs-secondary, #6c757d);
  font-size: 0.83rem;
}

.workflow-chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.workflow-chat-send-btn:hover {
  background: var(--bs-primary-text-emphasis, #0a58ca);
}

.workflow-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.workflow-chat-send-btn i {
  font-size: 0.875rem;
}

/* Empty state */
.workflow-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  flex: 1;
  color: var(--bs-secondary, #6c757d);
}

.workflow-chat-empty i {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.workflow-chat-empty h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: 0.35rem;
}

.workflow-chat-empty p {
  font-size: 0.8rem;
  margin: 0;
  max-width: 260px;
  line-height: 1.45;
}

/* ---- Dark mode ---- */
[data-bs-theme="dark"] .workflow-chat-panel {
  background: var(--bs-body-bg);
  border-left-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .workflow-chat-header {
  background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .workflow-chat-header-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .workflow-chat-message.assistant .workflow-chat-bubble {
  background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .workflow-chat-bubble pre {
  background: var(--bs-body-bg);
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .workflow-chat-bubble code {
  background: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .workflow-chat-message.user .workflow-chat-bubble code {
  background: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] .workflow-chat-starter {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .workflow-chat-starter:hover {
  background: rgba(var(--bs-primary-rgb), 0.12);
}

[data-bs-theme="dark"] .workflow-chat-input-area {
  background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .workflow-chat-input-area textarea {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .workflow-chat-input-area textarea:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
}

[data-bs-theme="dark"] .workflow-chat-changes-applied {
  background: rgba(var(--bs-success-rgb), 0.15);
  border-color: rgba(var(--bs-success-rgb), 0.3);
  color: var(--bs-success);
}

[data-bs-theme="dark"] .wf-chat-changes-json summary {
  background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .wf-chat-changes-json {
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .wf-chat-changes-json pre {
  border-top-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .workflow-chat-toggle {
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

/* ---- Responsive: overlay on narrow screens ---- */
@media (max-width: 1200px) {
  .workflow-chat-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .workflow-chat-panel.collapsed {
    box-shadow: none;
  }
}

@media (max-width: 768px) {
  .workflow-chat-panel {
    width: 100%;
  }

  .workflow-chat-toggle {
    top: auto;
    bottom: 1rem;
    transform: none;
    width: auto;
    height: auto;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    gap: 0.35rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  }

  .workflow-chat-toggle i {
    margin-bottom: 0;
  }
}
