:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1c2330;
  --muted: #6b7280;
  --primary: #2f6fed;
  --primary-dark: #2458c4;
  --success: #1a9e60;
  --danger: #d64545;
  --warning: #c98a1b;
  --code-bg: #f0f2f5;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 15px; margin-right: 8px; }
.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
}
.nav-link.active { color: var(--primary); background: #eaf1fe; font-weight: 600; }
.nav-link:hover { color: var(--text); }

.content { padding: 20px 24px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { border-color: #c4cad4; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

textarea, input[type="text"], input[type="search"], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
textarea:focus, input[type="text"]:focus, input[type="search"]:focus { outline: 2px solid #bfd4fb; outline-offset: 0; border-color: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--code-bg);
  color: var(--muted);
}
.badge.active, .badge.done { background: #dcf5e8; color: var(--success); }
.badge.disabled, .badge.failed { background: #fbe3e3; color: var(--danger); }
.badge.running, .badge.pending { background: #fdf1dd; color: var(--warning); }
.badge.delegator { background: #e8e3fb; color: #6a4fd0; }

/* ------------------------- Konuşma sayfası ------------------------- */

.conversation-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  height: calc(100vh - 92px);
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  overflow-y: auto;
}
.session-list { list-style: none; margin: 12px 0 0; padding: 0; }
.session-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-item:hover { background: var(--bg); }
.session-item.active { background: #eaf1fe; color: var(--primary); font-weight: 600; }

.conversation-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.empty-state {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* Solda konuşma parçaları, sağda bulgular. */
.conversation-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.transcript-panel,
.findings-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.panel-hint { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }

.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.chunk {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.chunk:hover { border-color: #c9d3e3; }
.chunk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.chunk-label { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.chunk-status { font-size: 11.5px; color: var(--warning); }
.chunk-error-state { border-color: #f3c8c8; }
.chunk-error-state .chunk-status { color: var(--danger); }
.chunk-sending, .chunk-queued { opacity: .75; }
.chunk-processing { border-color: var(--primary); }
.chunk-processing .chunk-status { color: var(--primary); }
.chunk-line { padding: 1px 0; white-space: pre-wrap; }
.chunk-speaker {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--primary);
  margin-right: 6px;
}
.chunk-error { margin-top: 6px; color: var(--danger); font-size: 12.5px; }

/* Kaynak işaretleme: bulgu <-> parça */
.has-source { cursor: pointer; border-radius: 4px; }
.has-source:hover { background: #f3f6fb; }
.chunk-highlight,
.finding-highlight {
  background: #fff6db !important;
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 1px var(--warning);
}
.source-active { box-shadow: 0 0 0 2px var(--primary); border-radius: 4px; }
.field-list li.has-source { padding: 0 4px; margin-left: -4px; }

@media (max-width: 1100px) {
  .conversation-split { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(320px, 1fr); }
}

.results-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

/* Agent grup kutusu: denetleyici + alt agent'lari tek kutuda toplar.
   Icerik dogal boyutta uzar; kaydirma dis .results-feed'de yapilir. */
.agent-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.agent-group-title {
  padding: 8px 14px;
  background: #eef3fb;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--primary);
  position: sticky;
  top: 0;
  z-index: 1;
}
.agent-group-own {
  padding: 0;
  display: flex;
  flex-direction: column;
}
.agent-group-own:empty { display: none; }
.agent-group-own .finding-body { border-top: 1px dashed var(--border); }
.agent-group-own .finding-body:first-child { border-top: 0; }
.agent-group-children {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-group-children:empty { display: none; }

.finding { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.finding-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}
.finding-header .called-by { font-weight: 400; color: var(--muted); font-size: 12px; }
.finding-reports { display: flex; flex-direction: column; }
.finding-body {
  padding: 10px 12px;
  white-space: pre-wrap;
  font-size: 13.5px;
  border-top: 1px dashed var(--border);
}
.finding-body:first-child { border-top: 0; }
.finding-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px 22px;
}
.finding-children:empty { display: none; }

.status-card {
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.status-card-title { font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.status-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 140px;
  overflow-y: auto;
}
.status-steps li {
  padding: 3px 0 3px 18px;
  position: relative;
  color: var(--muted);
  font-size: 13px;
}
.status-steps li::before {
  content: "";
  position: absolute;
  left: 4px; top: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.status-steps li:last-child { color: var(--text); }

.chunk-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.chunk-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.chunk-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.ws-state { font-size: 12px; color: var(--muted); }
.ws-state.online { color: var(--success); }
.ws-state.offline { color: var(--danger); }

.error-card {
  background: #fdf2f2;
  border: 1px solid #f3c8c8;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
}

/* ------------------------- Geliştirme sayfası ------------------------- */

.dev-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}
.dev-left, .dev-right { min-width: 0; }
.dev-layout h2 { font-size: 16px; margin: 0 0 10px; }
.dev-left h2:not(:first-child) { margin-top: 28px; }
.dev-right-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dev-right-header h2 { margin: 0; margin-right: auto; }
.dev-right-header .agent-search { width: 220px; }

#build-form textarea { margin-bottom: 10px; font-size: 13.5px; }
#build-form select { display: block; margin: 4px 0 10px; }

.job-card {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.job-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.job-log {
  background: #11151c;
  color: #c8d3e0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 0;
}
.job-error { color: var(--danger); font-size: 13px; margin-top: 8px; }

.agent-list { display: flex; flex-direction: column; gap: 12px; }
.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.agent-card.disabled { opacity: .65; }
.agent-card.has-error { border-color: #f3c8c8; }
.agent-issue {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
}
.agent-issue.error { background: #fdf2f2; color: var(--danger); }
.agent-issue.warning { background: #fdf6e8; color: var(--warning); }
.agent-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agent-card-header .agent-name { font-weight: 700; font-size: 14px; }
.agent-card-header .agent-display { color: var(--muted); }
.agent-card-header .spacer { flex: 1; }
.agent-routing { font-size: 13px; color: var(--muted); margin-top: 6px; }
.agent-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.agent-fields { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }
.agent-fields .badge { font-size: 11px; }
/* Yeni uretilen agent karti: parlayan yesil cizgi (birkac saniye surer). */
.agent-card-new {
  border-color: var(--success) !important;
  animation: agent-card-glow 2.2s ease-in-out 3;
}
@keyframes agent-card-glow {
  0%, 100% { box-shadow: 0 0 0 1px var(--success), 0 0 6px rgba(26, 158, 96, 0.3); }
  50% { box-shadow: 0 0 0 2px var(--success), 0 0 18px rgba(26, 158, 96, 0.6); }
}

.agent-edit { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; display: none; }
.agent-edit.open { display: block; }
.agent-edit label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.agent-edit textarea { font-size: 13px; }
.subagent-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.subagent-checks label { display: inline-flex; align-items: center; gap: 5px; font-weight: 400; margin: 0; }
.agent-edit-actions { display: flex; gap: 8px; margin-top: 12px; }

.toast {
  position: fixed;
  bottom: 20px; right: 20px;
  background: #11151c;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
}

/* --- Cikti alani editoru (Gelistirme) --- */
.fields-editor { display: flex; flex-direction: column; gap: 6px; }
.field-edit-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.field-edit-row .field-name { width: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.field-edit-row .field-type { width: 120px; }
.field-edit-row .field-desc { flex: 1; min-width: 160px; }
.field-edit-row .field-enum { width: 200px; }
.field-translations { flex-basis: 100%; background: var(--bg); border-radius: 6px; padding: 8px; }
.translations-grid { display: grid; gap: 4px 6px; align-items: center; overflow-x: auto; }
.translations-grid input { padding: 4px 6px; font-size: 12.5px; }
.schema-preview {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  overflow-x: auto;
  max-height: 320px;
}
.btn-link { background: none; border: none; color: var(--primary); padding: 0; margin-top: 8px; }

/* --- Konuşma: yapilandirma secici + alan bazli bulgular --- */
.new-session-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.new-session-picker label { font-size: 12px; font-weight: 600; color: var(--muted); }
.picker-actions { display: flex; gap: 8px; }
.session-header { margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.field-row { display: flex; gap: 8px; padding: 3px 0; font-size: 13px; align-items: baseline; }
.field-label { font-weight: 600; color: var(--muted); flex-shrink: 0; }
.field-value { min-width: 0; }
.field-list { margin: 2px 0 0; padding-left: 18px; }

/* --- Yapılandırma sayfası --- */
.config-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.config-toolbar label { font-size: 13px; font-weight: 600; color: var(--muted); }
.config-toolbar select { min-width: 220px; }
.new-config-form { display: flex; gap: 8px; margin-bottom: 14px; }
.new-config-form input { width: 280px; }
.config-editor-header { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.config-editor-header input { width: 280px; font-weight: 600; }
.config-warnings { margin-bottom: 10px; }
.config-columns { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.config-columns h3 { font-size: 14px; margin: 0 0 8px; }
.available-agents { display: flex; flex-direction: column; gap: 6px; }
.available-agent {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.available-agent .agent-name { font-weight: 600; font-size: 13px; }
.available-agent .muted { flex: 1; font-size: 12px; }
.config-agents { display: flex; flex-direction: column; gap: 10px; }
.config-agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.config-section-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.config-toolbar .spacer, .config-editor-header .spacer { flex: 1; }
.config-toolbar a.btn { text-decoration: none; }

/* --- Yapılandırma: Akış sayfası --- */
.flow-columns {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}
.flow-columns h3 { font-size: 14px; margin: 0 0 8px; }
.flow-palette, .flow-panel {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}
.flow-palette-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
}
.flow-palette-item.used { opacity: .5; cursor: default; }
.flow-palette-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.flow-palette-text .agent-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.flow-palette-text .muted { font-size: 12px; }
.flow-dirty { color: var(--warning); font-size: 12px; font-weight: 600; }

.flow-canvas-wrap {
  position: relative;
  height: calc(100vh - 260px);
  min-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: #fbfcfd;
  background-image: radial-gradient(#d9dee6 1px, transparent 1px);
  background-size: 20px 20px;
}
.flow-canvas { position: relative; min-width: 100%; min-height: 100%; }
.flow-edges, #flow-nodes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flow-edges { overflow: visible; }

.flow-node {
  position: absolute;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
  touch-action: none;
}
.flow-node.dragging { cursor: grabbing; opacity: .9; z-index: 2; }
.flow-node-name { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; line-height: 1.3; }
.flow-node-display { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; line-height: 1.3; }
.flow-node-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.flow-node-badges .badge { font-size: 11px; padding: 1px 6px; }

/* BPMN service task: yuvarlak koseli dikdortgen + disli ikonu (yaprak uzman agent) */
.flow-node.task {
  width: 200px;
  min-height: 64px;
  padding: 8px 10px 10px 32px;
  background: var(--surface);
  border: 2px solid #5c6573;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(17, 21, 28, .08);
}
.flow-task-icon { position: absolute; top: 8px; left: 9px; width: 17px; height: 17px; color: #5c6573; }
.flow-task-icon svg, .flow-palette-icon svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.flow-node.task.has-error { background: #fffafa; }
.flow-node.task.selected { border-color: var(--primary); box-shadow: 0 0 0 3px #d6e4fd; }
.flow-node.task.connect-target { border-color: var(--success); box-shadow: 0 0 0 3px #cdeedd; }

/* BPMN data output: gorevin yaninda belge ikonu, noktali iliskilendirme cizgisi */
.flow-data {
  position: absolute;
  top: 50%;
  right: -44px;
  width: 24px;
  transform: translateY(-50%);
  color: #5c6573;
  text-align: center;
}
.flow-data::before {
  content: "";
  position: absolute;
  top: 14px;
  left: -20px;
  width: 18px;
  border-top: 1.5px dotted #8b94a3;
}
.flow-data svg { width: 20px; height: 24px; display: block; margin: 0 auto; }
.flow-data .paper { fill: var(--surface); stroke: currentColor; stroke-width: 1.4; }
.flow-data .fold { fill: none; stroke: currentColor; stroke-width: 1.4; }
.flow-data .arrow { fill: currentColor; }
.flow-data-count { display: block; font-size: 11px; font-weight: 700; line-height: 1.2; }
.flow-data.empty { color: var(--danger); }

/* BPMN inclusive gateway: icinde daire olan baklava (denetleyici agent) */
.flow-node.gateway { width: 200px; display: flex; align-items: center; gap: 8px; }
.flow-gateway { position: relative; flex: none; width: 64px; height: 64px; }
.flow-gateway-shape { width: 64px; height: 64px; display: block; overflow: visible; }
.flow-gateway-shape polygon { fill: #faf8ff; stroke: #6a4fd0; stroke-width: 2.5; stroke-linejoin: round; }
.flow-gateway-shape circle { fill: none; stroke: #6a4fd0; stroke-width: 3.5; }
.flow-node.gateway .flow-node-label { min-width: 0; }
.flow-node.gateway.has-error .flow-gateway-shape polygon { fill: #fffafa; }
.flow-node.gateway.selected .flow-gateway-shape polygon { stroke: var(--primary); filter: drop-shadow(0 0 3px #a9c4f8); }
.flow-node.gateway.connect-target .flow-gateway-shape polygon { stroke: var(--success); }

/* BPMN olaylari: baslangic ince daire, bitis kalin daire */
.flow-node.event { width: 140px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.flow-event-circle { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); }
.flow-node.start .flow-event-circle { border: 2px solid var(--success); background: #f1fbf6; }
.flow-node.end .flow-event-circle { border: 5px solid var(--danger); background: #fdf5f5; }
.flow-event-label { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.flow-node.event.selected .flow-event-circle { box-shadow: 0 0 0 3px #d6e4fd; }

/* BPMN boundary (ara) olay: kenara iliştirilmis hata/uyari */
.flow-boundary { position: absolute; width: 20px; height: 20px; z-index: 1; cursor: help; }
.flow-node.task > .flow-boundary { top: -10px; right: -10px; }
.flow-gateway > .flow-boundary { top: 4px; right: 4px; }
.flow-boundary svg { width: 20px; height: 20px; display: block; }
.flow-boundary .ring { fill: var(--surface); stroke: currentColor; stroke-width: 1.3; }
.flow-boundary .ring.inner { fill: none; stroke-width: 1; }
.flow-boundary .bolt { fill: currentColor; }
.flow-boundary.error { color: var(--danger); }
.flow-boundary.warning { color: var(--warning); }

.flow-palette-icon { flex: none; width: 16px; height: 16px; color: #5c6573; }
.flow-port {
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid #9aa3b1;
}
.flow-port.in { top: -7px; pointer-events: none; }
.flow-port.out { bottom: -7px; cursor: crosshair; }
.flow-port.out:hover { border-color: var(--primary); background: #eaf1fe; transform: scale(1.25); }

.flow-edge { fill: none; stroke: #8b94a3; stroke-width: 2; }
.flow-edge.temp { stroke: var(--primary); stroke-dasharray: 6 4; }
.flow-edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.flow-edge-group:hover .flow-edge { stroke: #5c6573; }
.flow-edge-group.selected .flow-edge { stroke: var(--primary); stroke-width: 2.5; }
.flow-arrow-head { fill: #8b94a3; }
.flow-arrow-head.selected { fill: var(--primary); }
/* Turetilmis akislar (baslangic -> kokler, yapraklar -> bitis): duzenlenemez */
.flow-edge.implicit { stroke: #c4cad4; stroke-width: 1.5; stroke-dasharray: 4 3; }
.flow-arrow-head.implicit { fill: #c4cad4; }

.flow-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.flow-panel h3 { margin: 0 0 4px; font-size: 14px; }
.flow-panel-title { overflow-wrap: anywhere; }
.flow-panel p { margin: 6px 0; }
.flow-panel-remove { margin-top: 14px; }
.flow-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.flow-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--code-bg);
  font-size: 12px;
}
.flow-chip button { border: 0; background: none; cursor: pointer; font: inherit; color: var(--text); }
.flow-chip-name { padding: 2px 4px 2px 10px; }
.flow-chip-remove { padding: 2px 8px 2px 4px; color: var(--muted) !important; }
.flow-chip-remove:hover { color: var(--danger) !important; }
.flow-fields { display: flex; flex-direction: column; gap: 4px; }
.flow-field { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.flow-field .muted { margin-left: auto; }
.flow-prompt summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.flow-prompt-text {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  font-size: 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px 0 0;
}

.context-menu {
  position: fixed;
  z-index: 120;
  min-width: 170px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(17, 21, 28, .15);
}
.context-menu-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.context-menu-item:hover { background: var(--code-bg); }
.context-menu-item.danger { color: var(--danger); }

/* --- Profiller sayfası --- */
.profiles-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.profiles-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.profiles-sidebar h2, .profile-editor h2 { font-size: 15px; margin: 0; }
.profiles-sidebar-header { display: flex; justify-content: space-between; align-items: center; }
.languages-title { margin-top: 20px !important; }
.small { font-size: 12px; }
.language-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.language-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.language-row.disabled { opacity: .55; }
.language-row .spacer { flex: 1; }
.language-add { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.language-add #lang-code { grid-column: span 2; }
.language-add .btn { grid-column: span 2; }
.profile-editor .agent-edit { margin-top: 0; border-top: 0; padding-top: 0; }
.preview-toolbar { display: flex; align-items: center; gap: 10px; margin: 24px 0 10px; }
.preview-toolbar select { width: auto; }
.profile-editor h3 { font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
#profile-preview .schema-preview { white-space: pre-wrap; max-height: 360px; overflow-y: auto; }
.session-badges { display: flex; gap: 8px; align-items: center; }
.profile-select { width: auto; min-width: 140px; }

/* --- Projeler sayfası --- */
.project-form { margin-top: 0; border-top: 0; padding-top: 0; }
.project-configs { flex-direction: column; gap: 6px; }
.inline-check { display: inline-flex !important; align-items: center; gap: 6px; font-weight: 400 !important; }
.token-box { margin-top: 8px; }
.token-reveal {
  background: #fff6db;
  border: 1px solid var(--warning);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.token-warning { font-size: 12.5px; color: var(--warning); font-weight: 600; margin-bottom: 6px; }
.token-row { display: flex; align-items: center; gap: 8px; }
.token-value { font-size: 13px; user-select: all; word-break: break-all; }

/* --- Form ici mesaj gosterimi --- */
.form-error,
.form-success {
  border: 1px solid;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 10px;
  padding: 8px 10px;
  white-space: pre-line;
}
.form-error { background: #fdf2f2; border-color: #f3c8c8; color: var(--danger); }
.form-success { background: #f1fbf6; border-color: #cdeedd; color: var(--success); }
.field-row-error .field-name,
.field-row-error .field-type,
.field-row-error .field-desc,
.field-row-error .field-enum { border-color: #f3c8c8; }
.input-error { border-color: var(--danger) !important; }

/* --- Kullanim Kilavuzu --------------------------------------------------- */
.guide { max-width: 860px; margin: 0 auto; }
.guide h1 { font-size: 22px; margin: 0 0 16px; }
.guide h2 { font-size: 17px; margin: 26px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.guide h3 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); }
.guide p, .guide li { font-size: 14px; line-height: 1.55; }
.guide ul { margin: 6px 0 10px 20px; padding: 0; }
.guide li { margin-bottom: 4px; }
.guide code { background: var(--bg-soft, #f3f4f6); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.guide pre { background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font-size: 13px; overflow-x: auto; white-space: pre-wrap; }

/* --- İzleme (loglama) sayfası --- */
.logs-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  height: calc(100vh - 92px);
}
.logs-sidebar-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.logs-main {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.logs-item { white-space: normal; }
.logs-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.logs-item-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.logs-item-dots { display: flex; gap: 4px; }
.logs-dot { width: 8px; height: 8px; border-radius: 50%; }
.logs-dot.running { background: var(--warning); }
.logs-dot.error { background: var(--danger); }
.logs-item-title { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.logs-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; }
.logs-item-meta .badge { font-size: 11px; padding: 1px 6px; }

.trace { display: flex; flex-direction: column; gap: 14px; padding-right: 4px; }
.trace-chunk {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.trace-chunk.status-processing { border-color: var(--primary); }
.trace-chunk.status-error { border-color: #f3c8c8; }
.trace-chunk-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.trace-chunk-label { font-weight: 700; font-size: 13px; }
.trace-chunk-time { font-size: 12px; flex: 1; }
.trace-chunk-timing { font-size: 11.5px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }

/* Parça zaman çizelgesi: kuyruk+yükleme+run'lar, parça gelişine göre ölçekli barlar. */
.trace-timeline { position: relative; margin: 4px 0 8px; }
.tl-bar {
  position: absolute;
  height: 12px;
  min-width: 3px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 12px;
  color: #fff;
  padding: 0 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tl-bar.tl-queue { background: repeating-linear-gradient(45deg, #e4e7ec, #e4e7ec 4px, #eef0f4 4px, #eef0f4 8px); color: var(--muted); }
.tl-bar.tl-load { background: #b9c2d0; }
.tl-bar.tl-orchestrator { background: var(--primary); }
.tl-bar.tl-supervisor { background: #6a4fd0; }
.tl-bar.tl-specialist { background: #5c6573; }
.tl-bar.tl-err { background: var(--danger); }
/* Aktivite segmenti hover ipucu: sure + aralik + run ciktisi. */
.tl-tip {
  position: fixed;
  z-index: 60;
  max-width: 340px;
  max-height: 280px;
  overflow: auto;
  background: #232936;
  color: #eef0f4;
  font-size: 12px;
  line-height: 1.45;
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.tl-tip-head { font-weight: 600; }
.tl-tip-sub { color: #aab3c4; font-size: 11px; margin-top: 2px; }
.tl-tip-out { margin-top: 6px; white-space: pre-wrap; word-break: break-word; opacity: 0.92; }

.trace-chunk-text summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.trace-chunk-text .chunk-body { margin-top: 6px; font-size: 13px; }

/* Parça akış kanvası: akış sayfasıyla aynı BPMN görsel dili, salt-okunur. */
.trace-canvas {
  position: relative;
  margin: 10px 0 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: #fbfcfd;
  background-image: radial-gradient(#d9dee6 1px, transparent 1px);
  background-size: 20px 20px;
}
.trace-node { cursor: pointer; }
.trace-node:hover { filter: brightness(.98); }
.trace-node-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.trace-node-meta .flow-boundary { position: static; }
.flow-node.orch { border-color: var(--primary); }
.flow-node.orch .flow-task-icon { color: var(--primary); }

.trace-steps { margin-top: 6px; }
.trace-steps summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.trace-steps .status-steps { margin-top: 6px; max-height: 180px; }

/* Detay çekmecesi: node tıklayınca sağdan açılır. */
.trace-detail {
  position: fixed;
  top: 57px;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 14px rgba(17, 21, 28, .08);
  padding: 14px 16px;
  overflow-y: auto;
  z-index: 90;
}
.trace-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.trace-detail-head h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.trace-detail-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.trace-detail h4 { font-size: 12.5px; color: var(--muted); margin: 14px 0 4px; }
.trace-detail-text {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
}
.trace-chunk { overflow-x: auto; }

/* Ok ucu tiklama bolgeleri: gorunmez, hover'da isaretlenir */
.flow-tip-hit { fill: transparent; stroke: transparent; cursor: pointer; }
.flow-tip-hit:hover { fill: #d6e4fd; fill-opacity: .6; stroke: var(--primary); stroke-width: 1.5; }
.flow-tip-hit { pointer-events: all; }

/* İzleme: ok çizgisi hover'da mavi+kalın (ok uçlarıyla aynı renk) */
.flow-edge-group:hover .flow-edge { stroke: var(--primary); stroke-width: 2.5; }

/* --- Kimlik dogrulama / cok-kiracilik --- */
input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
  color: var(--text);
}

.nav-spacer { flex: 1; }
.user-chip {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 6px;
  white-space: nowrap;
}
.nav-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
}
.nav-logout:hover { color: var(--danger); border-color: var(--danger); }

#company-scope { display: inline-flex; align-items: center; gap: 6px; }
.scope-select { width: auto; min-width: 130px; padding: 4px 8px; font-size: 13px; }
.scope-badge { font-style: italic; }

/* --- Giris sayfasi --- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 40px;
  width: 360px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.login-brand { font-size: 20px; margin: 0 0 24px; text-align: center; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login-card .btn-block { margin-top: 20px; }

/* --- Yonetim sayfasi --- */
.admin-layout { max-width: 960px; margin: 0 auto; }
.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0;
}
.admin-section h2 { margin: 0 0 12px; font-size: 16px; }
.admin-section h3 { margin: 14px 0 8px; font-size: 14px; }
.admin-section-head { display: flex; align-items: center; justify-content: space-between; }
.admin-section-head select { width: auto; min-width: 160px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); padding: 6px 8px;
}
.admin-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table select { width: auto; min-width: 110px; padding: 4px 6px; }
.admin-actions { white-space: nowrap; }
.admin-actions .btn { margin-right: 4px; }
.admin-form { margin-top: 14px; }
.admin-form-row { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.admin-form-row input, .admin-form-row select { width: auto; flex: 1; min-width: 140px; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 12px;
  margin: 10px 0;
}
.perm-item { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.perm-tag { font-size: 11px; margin-right: 2px; }
.badge-global {
  background: #e8e3fb; color: #6a4fd0; font-size: 11px;
  padding: 1px 7px; border-radius: 10px; vertical-align: middle;
}
.badge-super {
  background: #dcf5e8; color: var(--success); font-size: 11px;
  padding: 1px 7px; border-radius: 10px;
}

/* --- İzleme V2 (canli agent akisi) --- */
/* Flow sayfasinin .flow-node/.flow-edge siniflari yeniden kullanilir; yeni
   kurallar .monitor-v2 kapsayi altinda tutulur. */
.monitor-v2 .monitor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.monitor-v2 .monitor-toolbar select { min-width: 220px; }
.monitor-v2 .monitor-canvas-wrap { height: calc(100vh - 240px); }
.monitor-v2 .monitor-canvas-zone { position: relative; }
.monitor-v2 .flow-node { cursor: pointer; }

/* "Calisiyor" paneli: kanvasin sag ustunde sabit, kaydirma ile hareket etmez. */
.monitor-v2 .live-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  width: 240px;
  max-height: min(60%, 420px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 28, 45, .18);
  font-size: 12px;
}
.monitor-v2 .live-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.monitor-v2 .live-follow {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.monitor-v2 .live-panel-rows { overflow-y: auto; padding: 4px; }
.monitor-v2 .live-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 4px 8px;
  margin: 0 0 2px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: left;
}
.monitor-v2 .live-panel-row:hover { background: var(--code-bg); }
.monitor-v2 .live-panel-row.waiting {
  border-style: dashed;
  border-color: var(--border);
  color: var(--muted);
}
.monitor-v2 .live-panel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.monitor-v2 .live-panel-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  font-weight: 600;
}
.monitor-v2 .live-panel-row.waiting .live-panel-time {
  color: var(--muted);
  font-weight: 400;
}

/* Satirdan/dugumden odaklaninca kisa parlaklik. */
@keyframes monitor-focus-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0); }
  40% { box-shadow: 0 0 0 6px rgba(47, 111, 237, .45), 0 0 18px rgba(47, 111, 237, .5); }
}
.monitor-v2 .flow-node.focus-flash { animation: monitor-focus-flash .6s ease-in-out 2; }

/* Agaca girmeyen agent (devre disi / dongude) soluk gosterilir. */
.monitor-v2 .flow-node.not-in-tree { opacity: .45; }

/* Secili parcada calisan / hatali calisan agent. */
.monitor-v2 .flow-node.ran .flow-event-circle,
.monitor-v2 .flow-node.ran.flow-node.task { border-color: var(--success); }
.monitor-v2 .flow-node.ran.flow-node.gateway .flow-gateway-shape polygon { stroke: var(--success); }
.monitor-v2 .flow-node.ran-error.flow-node.task { border-color: var(--danger); }
.monitor-v2 .flow-node.ran-error .flow-event-circle { border-color: var(--danger); }
.monitor-v2 .flow-node.ran-error.flow-node.gateway .flow-gateway-shape polygon { stroke: var(--danger); }

/* O an calisan agent: parlayan nabiz. */
@keyframes monitor-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 111, 237, .45), 0 0 12px rgba(47, 111, 237, .35); }
  50% { box-shadow: 0 0 0 7px rgba(47, 111, 237, 0), 0 0 20px rgba(47, 111, 237, .55); }
}
.monitor-v2 .flow-node.live-active { animation: monitor-pulse 1.4s ease-in-out infinite; z-index: 3; }
.monitor-v2 .flow-node.gateway.live-active .flow-gateway-shape { filter: drop-shadow(0 0 8px rgba(47, 111, 237, .7)); }
.monitor-v2 .flow-node.live-active .flow-event-circle { box-shadow: 0 0 0 4px rgba(47, 111, 237, .35), 0 0 14px rgba(47, 111, 237, .5); }

/* Alt agent'i calisan ust: bekliyor (kesikli soluk cerceve, nabiz yok). */
.monitor-v2 .flow-node.live-waiting {
  animation: none;
  z-index: 3;
  opacity: .72;
}
.monitor-v2 .flow-node.live-waiting.flow-node.task { border-style: dashed; border-color: var(--primary); }
.monitor-v2 .flow-node.live-waiting .flow-event-circle {
  border-style: dashed;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(47, 111, 237, .15), 0 0 8px rgba(47, 111, 237, .2);
}
.monitor-v2 .flow-node.gateway.live-waiting .flow-gateway-shape polygon { stroke-dasharray: 5 4; }
.monitor-v2 .flow-node.gateway.live-waiting .flow-gateway-shape { filter: drop-shadow(0 0 4px rgba(47, 111, 237, .3)); }

@media (prefers-reduced-motion: reduce) {
  .monitor-v2 .flow-node.live-active {
    animation: none;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .4), 0 0 14px rgba(47, 111, 237, .45);
  }
  .monitor-v2 .flow-edge.active { stroke-dasharray: none; }
  .monitor-v2 .flow-node.focus-flash {
    animation: none;
    outline: 3px solid var(--primary);
  }
}

/* Canli sure rozeti (kutunun altinda). */
.monitor-v2 .live-timer {
  display: none;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.monitor-v2 .live-timer.on { display: inline-block; }
.monitor-v2 .flow-node.live-active .live-timer {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.monitor-v2 .live-timer.waiting,
.monitor-v2 .flow-node.live-waiting .live-timer {
  border-style: dashed;
  color: var(--muted);
  font-weight: 400;
}
.monitor-v2 .flow-node.event { align-items: center; }

/* Aktif cagri kenari (cagiran -> agent). */
@keyframes monitor-edge-flow { to { stroke-dashoffset: -20; } }
.monitor-v2 .flow-edge.active {
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-dasharray: 8 6;
  animation: monitor-edge-flow .8s linear infinite;
  marker-end: url(#flow-arrow-active);
}
.flow-arrow-head.active { fill: var(--primary); }

/* Detay pop-up. */
.node-detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  width: min(680px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(20, 28, 45, .25);
}
.node-detail::backdrop { background: rgba(20, 28, 45, .35); }
.node-detail .detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.node-detail .detail-title { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.node-detail .detail-meta { display: flex; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
.node-detail .detail-run-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.node-detail .detail-run-text {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
}
.node-detail .detail-run summary { cursor: pointer; font-size: 13px; padding: 6px 0; }
.node-detail .detail-run.err summary { color: var(--danger); }

/* Zaman cizelgesi: koyu = calisiyor, acik = alt agent'i bekliyor, tarali = kayit oncesi. */
.monitor-v2 .timeline { margin-top: 14px; }
.monitor-v2 .timeline-title { font-size: 14px; margin: 0 0 8px; }
.monitor-v2 .timeline-rows { margin-bottom: 4px; }
.monitor-v2 .tl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 18px;
  margin-bottom: 4px;
  border-radius: 3px;
}
.monitor-v2 .tl-label {
  width: 160px;
  flex: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text);
}
.monitor-v2 .tl-track {
  position: relative;
  flex: 1;
  height: 12px;
  background: var(--code-bg);
  border-radius: 3px;
  border: 1px solid transparent;
}
.monitor-v2 .tl-track.tl2-err { border-color: var(--danger); }
.monitor-v2 .tl2-seg { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.monitor-v2 .tl2-work.orchestrator { background: var(--primary); }
.monitor-v2 .tl2-work.supervisor { background: var(--warning); }
.monitor-v2 .tl2-work.specialist { background: var(--success); }
.monitor-v2 .tl2-wait.orchestrator { background: rgba(47, 111, 237, .28); }
.monitor-v2 .tl2-wait.supervisor { background: rgba(201, 138, 27, .28); }
.monitor-v2 .tl2-wait.specialist { background: rgba(26, 158, 96, .28); }
.monitor-v2 .tl2-unknown {
  background: repeating-linear-gradient(
    45deg,
    rgba(107, 114, 128, .45) 0 4px,
    rgba(107, 114, 128, .12) 4px 8px
  );
}
.monitor-v2 .tl2-queue, .monitor-v2 .tl2-load { background: rgba(107, 114, 128, .4); }
.monitor-v2 .timeline-axis { position: relative; height: 16px; margin-left: 168px; }
.monitor-v2 .tl-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.monitor-v2 .tl-tick:first-child { transform: none; }
.monitor-v2 .tl-tick:last-child { transform: translateX(-100%); }
.monitor-v2 .tl-row.tl-hover { background: rgba(47, 111, 237, .08); }
.monitor-v2 .flow-node.tl-hover.flow-node.task { border-color: var(--primary); }
.monitor-v2 .flow-node.tl-hover .flow-event-circle { border-color: var(--primary); }
.monitor-v2 .flow-node.gateway.tl-hover .flow-gateway-shape polygon { stroke: var(--primary); }
.field-subrows { flex-basis: 100%; margin: 4px 0 4px 24px; padding-left: 12px; border-left: 2px solid var(--border, #d0d5dd); display: flex; flex-direction: column; gap: 4px; }
.field-subrows .field-edit-row { padding: 2px 0; }
