/* === Flows page === */

.flows-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.flows-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.flows-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.flows-search input {
  width: 240px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.flows-search input:focus {
  border-color: var(--accent, #6c5ce7);
}

.flows-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 20px;
  height: calc(100vh - 200px);
  min-height: 520px;
}

/* Sidebar */

.flows-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.flows-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.flows-section-label + .flows-section-label,
.flows-list + .flows-section-label {
  margin-top: 20px;
}

.flows-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flows-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.flows-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.flows-list-item.active {
  background: rgba(108, 92, 231, 0.12);
  border-color: rgba(108, 92, 231, 0.4);
}

.flows-list-name {
  font-size: 13px;
  font-weight: 500;
}

.flows-list-tags {
  font-size: 11px;
  color: var(--text-muted);
}

.flows-empty-small {
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 0;
}

.flows-agents {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flows-agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  font-size: 12px;
}

.flows-agent-emoji {
  font-size: 16px;
}

.flows-agent-name {
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

.flows-agent-role {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: auto;
}

/* Canvas */

.flows-canvas {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.flows-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.flows-toolbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.flows-toolbar-actions {
  display: flex;
  gap: 8px;
}

.flows-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0),
    var(--surface);
  background-size: 24px 24px;
}

.flows-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.flows-status {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
  border-top: 1px solid var(--border);
}

.flows-legend {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.15);
}

.flows-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.legend-agent    { background: #6c5ce7; }
.legend-task     { background: #00b894; }
.legend-approval { background: #fdcb6e; }
.legend-event    { background: #74b9ff; }

/* SVG graph */

.flow-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.flow-edge path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 1.5;
  marker-end: url(#flow-arrow);
}

.flow-edge { color: rgba(255, 255, 255, 0.25); }

.flow-edge text {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}

.flow-edge-dashed path {
  stroke-dasharray: 4 4;
  stroke: rgba(255, 121, 121, 0.45);
}

.flow-edge-dashed { color: rgba(255, 121, 121, 0.45); }

.flow-node {
  cursor: pointer;
}

.flow-node-rect {
  fill: var(--surface);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.5;
  transition: stroke 0.12s, fill 0.12s;
}

.flow-node:hover .flow-node-rect {
  stroke: rgba(255, 255, 255, 0.45);
  fill: rgba(255, 255, 255, 0.04);
}

.flow-node-label {
  fill: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}

.flow-node-sub {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: 'Inter', sans-serif;
}

.flow-node-agent .flow-node-rect    { stroke: rgba(108, 92, 231, 0.65); }
.flow-node-task .flow-node-rect     { stroke: rgba(0, 184, 148, 0.55); }
.flow-node-approval .flow-node-rect { stroke: rgba(253, 203, 110, 0.6); }
.flow-node-event .flow-node-rect    { stroke: rgba(116, 185, 255, 0.55); }

.flow-node-selected .flow-node-rect {
  stroke-width: 2.5;
  fill: rgba(108, 92, 231, 0.08);
}

/* Linear view */

.flow-linear {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
}

.flow-linear-agent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 24px;
  background: rgba(108, 92, 231, 0.12);
  border: 1px solid rgba(108, 92, 231, 0.4);
  border-radius: 10px;
  min-width: 180px;
  text-align: center;
}

.flow-linear-agent-emoji {
  font-size: 28px;
}

.flow-linear-agent-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.flow-linear-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 110px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.flow-step-num {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.flow-step-icon { font-size: 22px; }

.flow-step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.flow-step-agent {
  font-size: 11px;
  color: var(--text-muted);
}

.flow-step-arrow {
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 300;
}

/* Detail panel */

.flows-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.flows-detail-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
}

.flows-detail-section {
  margin-bottom: 18px;
}

.flows-detail-section:last-child {
  margin-bottom: 0;
}

.flows-detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.flows-detail-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.flows-detail-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.flows-detail-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}

.flows-detail-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

.flows-detail-edges {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
}

.flows-detail-edges i {
  color: var(--text-muted);
  font-style: normal;
  margin-left: 4px;
}

/* Responsive */

@media (max-width: 980px) {
  .flows-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .flows-sidebar,
  .flows-detail {
    max-height: 240px;
  }

  .flows-canvas {
    min-height: 480px;
  }
}
