/* workflows.css */
body { direction: ltr; }
.wf-main [hidden], .wf-modal [hidden] { display: none !important; }
.wf-mobile-links { display: none; }
@media (max-width: 640px) {
  .wf-mobile-links { display: flex; gap: 24px; padding: 14px 24px 0; }
  .wf-mobile-links a { color: #ffc107; text-decoration: none; }
}

.wf-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink, #ffffff);
}

.wf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.wf-page-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.2;
}

.wf-page-desc {
  color: var(--ink-soft, #cfcfcf);
  font-size: 16px;
  margin: 0;
  max-width: 600px;
}

.wf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.wf-btn-primary {
  background: var(--honey, #f4b400);
  color: #121212;
}

.wf-btn-primary:hover:not(:disabled) {
  background: var(--honey-deep, #ff9500);
  transform: translateY(-1px);
}

.wf-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wf-btn-ghost {
  background: transparent;
  border-color: var(--line, rgba(244,180,0,0.18));
  color: var(--honey, #f4b400);
}

.wf-btn-ghost:hover:not(:disabled) {
  background: rgba(244,180,0,0.08);
}

.wf-btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wf-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.wf-section {
  animation: wfFadeIn 0.3s ease;
}

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

/* Browse Section */
.wf-filters {
  margin-bottom: 24px;
}

.wf-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 11px;
  color: var(--ink, #ffffff);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.wf-input:focus {
  outline: none;
  border-color: var(--honey, #f4b400);
  background: rgba(0,0,0,0.6);
}

.wf-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.wf-textarea {
  resize: vertical;
  min-height: 100px;
}

.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.wf-card {
  background: linear-gradient(180deg, rgba(28,28,28,0.8) 0%, rgba(18,18,18,0.8) 100%);
  border: 1px solid var(--line, rgba(244,180,0,0.18));
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.wf-card:hover, .wf-card:focus-visible {
  border-color: rgba(244,180,0,0.4);
  transform: translateY(-2px);
  outline: none;
}

.wf-card:focus-visible {
  box-shadow: 0 0 0 2px var(--honey, #f4b400);
}

.wf-card-cat {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--honey, #f4b400);
  font-weight: 700;
  margin-bottom: 8px;
}

.wf-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
}

.wf-card-desc {
  color: var(--ink-soft, #cfcfcf);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wf-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-dim, #888888);
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.wf-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wf-meta-price {
  color: var(--honey, #f4b400);
  font-weight: 600;
}

.wf-empty, .wf-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--ink-dim, #888888);
  font-size: 15px;
}

.wf-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
}

/* Create Section */
.wf-create-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line, rgba(244,180,0,0.18));
}

.wf-create-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.wf-notice {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wf-notice-warning {
  background: rgba(244,180,0,0.08);
  border: 1px solid rgba(244,180,0,0.3);
}

.wf-notice p {
  margin: 0;
  font-size: 14px;
  color: var(--ink, #ffffff);
}

.wf-form {
  max-width: 640px;
  background: var(--card, #1c1c1c);
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--line, rgba(244,180,0,0.18));
}

.wf-form-group {
  margin-bottom: 20px;
}

.wf-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--honey, #f4b400);
  margin-bottom: 8px;
}

.wf-help-text {
  font-size: 12.5px;
  color: var(--ink-dim, #888888);
  margin: 0 0 10px;
  line-height: 1.5;
}

.wf-prompt-search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.wf-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #222;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
}

.wf-search-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 14px;
}

.wf-search-item:last-child {
  border-bottom: none;
}

.wf-search-item:hover, .wf-search-item:focus-visible {
  background: rgba(244,180,0,0.1);
  outline: none;
}

.wf-selected-prompts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wf-selected-prompt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 14px;
}

.wf-sp-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wf-sp-num {
  font-size: 12px;
  color: var(--ink-dim, #888888);
  background: rgba(255,255,255,0.1);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.wf-sp-actions {
  display: flex;
  gap: 6px;
}

.wf-icon-btn {
  background: transparent;
  border: none;
  color: var(--ink-dim, #888888);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.wf-icon-btn:hover:not(:disabled) {
  color: var(--ink, #ffffff);
  background: rgba(255,255,255,0.1);
}

.wf-icon-btn.remove:hover:not(:disabled) {
  color: var(--error, #ff6b6b);
  background: rgba(255,107,107,0.1);
}

.wf-icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.wf-form-actions {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: flex-end;
}

.wf-form-error, .wf-form-success {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.wf-form-error {
  background: rgba(255,107,107,0.1);
  color: var(--error, #ff6b6b);
  border: 1px solid rgba(255,107,107,0.3);
}

.wf-form-success {
  background: rgba(76,217,123,0.1);
  color: var(--success, #4cd97b);
  border: 1px solid rgba(76,217,123,0.3);
}

/* Modal */
.wf-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.wf-modal.is-open {
  display: flex;
}

.wf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}

.wf-modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--card, #1c1c1c);
  border: 1px solid var(--line, rgba(244,180,0,0.18));
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}

.wf-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
}

.wf-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink, #ffffff);
}

.wf-modal-close {
  background: transparent;
  border: none;
  color: var(--ink-dim, #888888);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.wf-modal-close:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: var(--ink, #ffffff);
}

.wf-modal-close:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.wf-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.wf-modal-desc {
  font-size: 14.5px;
  color: var(--ink-soft, #cfcfcf);
  line-height: 1.6;
  margin: 0 0 24px;
}

.wf-modal-loading {
  text-align: center;
  padding: 30px 0;
  color: var(--ink-dim, #888888);
  font-size: 14px;
}

.wf-run-form {
  margin-top: 16px;
}

.wf-run-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.wf-run-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.wf-run-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--honey, #f4b400);
}

.wf-run-result {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line, rgba(244,180,0,0.18));
}

.wf-run-result h4 {
  font-size: 16px;
  color: var(--honey, #f4b400);
  margin: 0 0 12px;
}

.wf-result-actions {
  margin-bottom: 12px;
}

.wf-result-output {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--ink, #ffffff);
  max-height: 300px;
  overflow-y: auto;
  user-select: text;
}

.wf-run-steps {
  margin-top: 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
}

.wf-run-steps summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft, #cfcfcf);
  user-select: none;
}

.wf-run-steps summary:hover {
  color: var(--ink, #ffffff);
}

.wf-steps-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wf-step-item {
  white-space: pre-wrap;
  font-size: 13px;
  padding-right: 12px;
  margin-left: 12px;
  border-left: 2px solid var(--honey, #f4b400);
  padding-left: 12px;
  color: var(--ink-soft, #cfcfcf);
}

.wf-step-title {
  font-weight: 600;
  color: var(--ink, #ffffff);
  margin-bottom: 4px;
}

.wf-warning-block {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(244,180,0,0.08);
  border: 1px solid rgba(244,180,0,0.3);
  color: var(--ink, #ffffff);
}

.wf-auth-link {
  color: var(--honey, #f4b400);
  text-decoration: underline;
  font-weight: 600;
}

@media (max-width: 600px) {
  .wf-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .wf-run-footer {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  .wf-run-footer .wf-btn {
    width: 100%;
  }
}
