/* The VerseAI Workflow Assistant dialog of the Workflows tab (js/workflow-ai-builder.js; note 107). The look is the
   Workflows editor's own: the .wf-modal frame of chat.html, its violet AI accent, its greys. Moved here from chat.html's
   inline style block, with the new parts: the replace question, the cost line and the summary of what changed. */
.wf-ai-overlay [hidden] { display: none !important; }
.wf-ai-modal { width: calc(100vw - 32px); max-width: 640px; max-height: 88vh; }
.wf-ai-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.wf-ai-star { color: #8b5cf6; flex-shrink: 0; }
.wf-ai-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wf-ai-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e5e7eb; margin-bottom: 12px; overflow-x: auto; }
.wf-ai-tab { background: transparent; border: none; padding: 8px 14px; font-size: 13px; font-weight: 500; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; white-space: nowrap; }
.wf-ai-tab:hover { color: #111827; }
.wf-ai-tab.active { color: #7c3aed; border-bottom-color: #8b5cf6; }
.wf-ai-modes { display: flex; gap: 6px; margin-bottom: 8px; }
.wf-ai-mode { flex: 1; background: transparent; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px; font-size: 13px; font-weight: 500; color: #6b7280; cursor: pointer; font-family: inherit; }
.wf-ai-mode:hover { color: #111827; border-color: #c4b5fd; }
.wf-ai-mode.active { color: #6d28d9; border-color: #8b5cf6; background: rgba(139, 92, 246, .06); }
.wf-ai-hint { font-size: 12px; color: #6b7280; line-height: 1.5; margin: 0 0 8px; }
.wf-ai-addhint { background: rgba(139, 92, 246, .06); border: 1px solid rgba(139, 92, 246, .15); border-radius: 6px; padding: 8px 10px; }
.wf-ai-textarea { display: block; width: 100%; min-height: 110px; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-family: inherit; font-size: 13px; line-height: 1.5; resize: vertical; outline: none; background: #fff; color: #111827; }
.wf-ai-textarea:focus { border-color: #8b5cf6; box-shadow: 0 0 0 2px rgba(139, 92, 246, .15); }
.wf-ai-textarea[readonly] { background: #f9fafb; }
.wf-ai-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wf-ai-example { background: #f3f4f6; border: 1px solid #e5e7eb; color: #374151; padding: 5px 11px; border-radius: 999px; font-size: 11px; cursor: pointer; font-family: inherit; text-align: start; }
/* what is read, said under the request; the notice when the secret-field list did not load */
.wf-ai-info { margin: 6px 0 0; font-size: 11.5px; line-height: 1.45; color: #6b7280; }
.wf-ai-marks { margin: 8px 0 0; padding: 8px 10px; font-size: 12px; line-height: 1.45; color: #78350f; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px; }
.wf-ai-example:hover { background: #ede9fe; border-color: #c4b5fd; color: #6d28d9; }
.wf-ai-cost { margin: 10px 0 0; font-size: 11.5px; color: #6b7280; font-variant-numeric: tabular-nums; }

/* The replace question: a decision, so it sits where the eye already is, above the footer */
.wf-ai-confirm { margin-top: 12px; padding: 12px 14px; border: 1px solid #fcd34d; background: #fffbeb; border-radius: 6px; }
.wf-ai-confirm-text { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: #78350f; }
.wf-ai-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* What changed: one line per kind of change; it stays until dismissed */
.wf-ai-summary { margin-top: 12px; padding: 12px 14px; border: 1px solid #ddd6fe; background: #faf8ff; border-radius: 6px; }
.wf-ai-sum-title { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: #4c1d95; }
.wf-ai-sum-line { margin: 0 0 4px; font-size: 13px; line-height: 1.5; color: #1f2937; overflow-wrap: anywhere; }
.wf-ai-sum-line b { font-weight: 600; color: #111827; }
.wf-ai-sum-needs { color: #78350f; }
.wf-ai-sum-model { color: #4b5563; font-style: italic; }
.wf-ai-sum-cost { margin: 6px 0 0; font-size: 12px; color: #4b5563; font-variant-numeric: tabular-nums; }
.wf-ai-sum-cost:empty { display: none; }
.wf-ai-sum-note { margin: 6px 0 0; font-size: 12px; color: #4b5563; }
.wf-ai-sum-note:empty { display: none; }
.wf-ai-sum-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wf-ai-linkbtn { background: transparent; border-color: transparent; color: #6b7280; }
.wf-ai-linkbtn:hover { background: transparent; border-color: transparent; color: #111827; text-decoration: underline; }

.wf-ai-answer { margin-top: 12px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; color: #1f2937; font-size: 13px; line-height: 1.6; white-space: pre-wrap; max-height: 280px; overflow-y: auto; }
.wf-ai-footer { flex-wrap: wrap; align-items: center; }
.wf-ai-status { font-size: 12px; color: #6b7280; display: inline-flex; align-items: center; gap: 6px; margin-right: auto; min-width: 0; flex: 1 1 200px; line-height: 1.4; }
.wf-ai-spinner { width: 12px; height: 12px; flex-shrink: 0; border: 2px solid #e5e7eb; border-top-color: #8b5cf6; border-radius: 50%; animation: wf-ai-spin .8s linear infinite; }
@keyframes wf-ai-spin { to { transform: rotate(360deg); } }
.wf-ai-modal button:focus-visible, .wf-ai-modal textarea:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
.wf-ai-modal button:disabled { opacity: .55; cursor: not-allowed; }

[data-theme="dark"] .wf-ai-textarea { background: #1f2937; border-color: #374151; color: #f3f4f6; }
[data-theme="dark"] .wf-ai-textarea[readonly] { background: #111827; }
[data-theme="dark"] .wf-ai-hint, [data-theme="dark"] .wf-ai-cost, [data-theme="dark"] .wf-ai-status, [data-theme="dark"] .wf-ai-info, [data-theme="dark"] .wf-ai-sum-cost { color: #9ca3af; }
[data-theme="dark"] .wf-ai-marks { background: #2a2111; border-color: #a16207; color: #fde68a; }
[data-theme="dark"] .wf-ai-tabs { border-color: #374151; }
[data-theme="dark"] .wf-ai-tab, [data-theme="dark"] .wf-ai-mode { color: #9ca3af; border-color: #374151; }
[data-theme="dark"] .wf-ai-tab:hover, [data-theme="dark"] .wf-ai-mode:hover { color: #f3f4f6; }
[data-theme="dark"] .wf-ai-tab.active, [data-theme="dark"] .wf-ai-mode.active { color: #c4b5fd; border-color: #8b5cf6; }
[data-theme="dark"] .wf-ai-example { background: #1f2937; border-color: #374151; color: #d1d5db; }
[data-theme="dark"] .wf-ai-example:hover { background: #312e81; border-color: #6366f1; color: #e0e7ff; }
[data-theme="dark"] .wf-ai-answer { background: #111827; border-color: #374151; color: #e5e7eb; }
[data-theme="dark"] .wf-ai-confirm { background: #2a2111; border-color: #a16207; }
[data-theme="dark"] .wf-ai-confirm-text { color: #fde68a; }
[data-theme="dark"] .wf-ai-summary { background: #1c1730; border-color: #4c1d95; }
[data-theme="dark"] .wf-ai-sum-title { color: #ddd6fe; }
[data-theme="dark"] .wf-ai-sum-line, [data-theme="dark"] .wf-ai-sum-line b { color: #e5e7eb; }
[data-theme="dark"] .wf-ai-sum-needs { color: #fde68a; }
[data-theme="dark"] .wf-ai-sum-model, [data-theme="dark"] .wf-ai-sum-note { color: #9ca3af; }

@media (max-width: 480px) {
    .wf-ai-modes { flex-direction: column; }
    .wf-ai-footer .wf-btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .wf-ai-spinner { animation: none; border-top-color: #8b5cf6; border-right-color: #8b5cf6; }
}
