/* ===== TaskFlow: enterprise SaaS overrides ===== */
:root {
  --tf-accent: #4f46e5;
  --tf-muted: #5a6478;
  --tf-border: rgba(79, 70, 229, 0.08);
  --tf-surface: linear-gradient(160deg, #ffffff 0%, #fafaff 100%);
}

#taskflowSection.taskflow-section {
  padding: 32px 24px 28px;
  background: transparent;
  margin: 0 0 16px;
  border-radius: 14px;
}

.taskflow-header { max-width: 1100px; margin-bottom: 20px; }
.taskflow-title {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 700;
  margin: 0;
  color: #0d1117;
  letter-spacing: -0.03em;
}
.taskflow-subtitle {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--tf-muted);
  max-width: 900px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
.taskflow-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

/* ── Taskflow header: 3-step visual flow ── */
.taskflow-steps-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tsf-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 8px;
  border-radius: 20px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s;
}
.tsf-step--mid {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.tsf-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  line-height: 1;
}
.tsf-step--mid .tsf-num {
  background: #4f46e5;
}
.tsf-label {
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: -0.01em;
}
.tsf-step--mid .tsf-label {
  color: #4338ca;
  font-weight: 600;
}
.tsf-sep {
  color: #c7d2fe;
  font-size: 14px;
  font-weight: 300;
  flex-shrink: 0;
}
.taskflow-tagline {
  margin: 8px auto 0;
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
  letter-spacing: 0.01em;
}

/* Visual connector between Import and Export cards */
.taskflow-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  min-width: 60px;
  user-select: none;
  flex-shrink: 0;
}
.tfc-svg {
  display: block;
  flex-shrink: 0;
  overflow: visible;
}

@media (max-width: 1024px) {
  .taskflow-grid {
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
  }
}
@media (max-width: 768px) {
  .taskflow-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .taskflow-connector {
    display: none;
  }
}

/* card */
.taskflow-card {
  background: var(--tf-surface);
  border: 1px solid rgba(209, 215, 228, 0.9);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(14, 20, 60, 0.05), 0 4px 16px rgba(14, 20, 60, 0.04);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.taskflow-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(14, 20, 60, 0.06), 0 8px 28px rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.22);
}

.taskflow-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(14, 20, 60, 0.05);
}

.taskflow-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: linear-gradient(145deg, #f3f2ff, #ebe9fe);
  color: var(--tf-accent);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
  flex-shrink: 0;
}

.taskflow-card-title { margin: 0; font-size: 16px; font-weight: 700; color: #0d1117; letter-spacing: -0.02em; }
.taskflow-card-desc { margin: 0; font-size: 13px; color: var(--tf-muted); }

.taskflow-card-features { margin: 6px 0 0; padding-left: 16px; font-size: 13px; color: var(--tf-muted); }
.taskflow-card-features li { margin: 4px 0; }

/* Buttons */
.taskflow-card .taskflow-card-btn {
  margin-top: auto;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.taskflow-card .btn-primary {
  background: linear-gradient(160deg, #5b56f0 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}
.taskflow-card .btn-primary:hover {
  background: linear-gradient(160deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.38);
}

/* Export button */
.taskflow-card .taskflow-export-btn.btn-success {
  background: linear-gradient(160deg, #10b981, #059669);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.taskflow-card .taskflow-export-btn.btn-success:hover {
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

/* secondary */
.taskflow-card .btn-secondary {
  background: #f5f4ff;
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.2);
}
.taskflow-card .btn-secondary:hover {
  background: #ebe9fe;
  border-color: rgba(79, 70, 229, 0.35);
}

/* small screens */
@media (max-width: 860px) {
  #taskflowSection.taskflow-section { padding: 18px; }
  .taskflow-title { font-size: 19px; }
  .taskflow-subtitle { font-size: 13px; }
  .taskflow-card { padding: 16px; border-radius: 10px; min-height: 160px; }
  .taskflow-card-icon { width: 40px; height: 40px; font-size: 17px; border-radius: 9px; }
  .taskflow-card .taskflow-card-btn { height: 38px; font-size: 13px; border-radius: 7px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Current Rules Panel (sidebar, replaces taskflow-card-rules)
   ════════════════════════════════════════════════════════════════════════════ */
.crp-shell {
  padding: 12px 14px 10px;
}
.crp-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 32px;
}
.crp-icon {
  font-size: 15px;
  line-height: 1;
}
.crp-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  flex: 1 1 auto;
}
.crp-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.crp-action-btn {
  padding: 2px 8px !important;
  font-size: 11px !important;
  height: 24px !important;
  border-radius: 5px !important;
  white-space: nowrap;
}
.crp-list {
  margin-top: 6px;
  font-size: 12px;
  overflow: hidden;
}
/* Compact in empty state — no artificial min-height, clean narrow display */
.crp-list .rules-empty-guide {
  padding: 6px 0 4px;
  background: none;
  border: none;
  border-radius: 0;
  margin: 0;
  gap: 4px;
}
.crp-list .rules-empty-guide-title {
  font-size: 12px;
  color: #94a3b8;
}
.crp-list .rules-empty-guide-body {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
/* When rules exist: cap height and enable scroll */
.crp-list.crp-list--has-rules {
  max-height: 160px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.crp-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0 6px;
}

/* ════════════════════════════════════════════════════════════════════════════
   Quick Start Card
   ════════════════════════════════════════════════════════════════════════════ */
.qs-section {
  background: linear-gradient(135deg, #f8f7ff 0%, #f0fdf4 100%);
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.qs-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.qs-header-icon {
  font-size: 18px;
  line-height: 1;
}
.qs-header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.qs-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.qs-subtitle {
  font-size: 11px;
  color: #64748b;
}
.qs-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}
.qs-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #c7d2fe;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #4f46e5;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
}
.qs-chip:hover {
  background: #eef2ff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}
.qs-chip:active {
  transform: translateY(0);
  box-shadow: none;
}
.qs-chip-icon {
  font-size: 14px;
}
.qs-chip-video {
  border-color: #c7d2fe;
  color: #4f46e5;
}
.qs-chip-video:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

/* ════════════════════════════════════════════════════════════════════════════
   Preview Toolbar (slim single-row, replaces heavy .table-head + .view-tools)
   ════════════════════════════════════════════════════════════════════════════ */
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
}
.preview-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6366f1;
  flex-shrink: 0;
}
.preview-change-badge {
  font-size: 11px !important;
  flex-shrink: 0;
}
.ptb-divider {
  width: 1px;
  height: 16px;
  background: #cbd5e1;
  flex-shrink: 0;
  align-self: center;
}
.ptb-field-search {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 200px;
  font-size: 12px !important;
  height: 28px !important;
  padding: 0 8px !important;
}
.preview-toolbar .view-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.preview-toolbar .view-group-label {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}
.preview-toolbar .select.compact {
  height: 28px;
  font-size: 12px;
  padding: 0 6px;
}
.preview-toolbar .input.short {
  height: 28px;
  font-size: 12px;
  padding: 0 8px;
  width: 120px;
}
.preview-toolbar .btn {
  height: 28px;
  font-size: 12px;
  padding: 0 10px;
  white-space: nowrap;
}
.preview-toolbar .btn-preview-clear {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .preview-toolbar {
    gap: 4px;
    padding: 6px 10px;
  }
  .ptb-field-search {
    max-width: 140px;
  }
  .qs-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
