/* AEG UI — Panels & Detail */

/* ── Detail panel shell ──────────────────────────────────── */
#app-detail {
  display: flex;
  flex-direction: column;
}

#detail-collapse-btn {
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  color: var(--color-muted);
}
#detail-collapse-btn:hover { color: var(--color-text); }

.detail-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.detail-header-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.detail-close {
  margin-left: auto;
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  cursor: pointer;
  font-size: 16px;
}
.detail-close:hover { background: var(--bg-surface-2); color: var(--color-text); }

.detail-node-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1.3;
}
.detail-node-epic {
  font-size: var(--font-size-xs);
  color: var(--color-text-dim);
  margin-top: 2px;
}
.detail-scope-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 700;
  background: var(--bg-surface-3);
  color: var(--color-text-dim);
  letter-spacing: 0.5px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Tabs ────────────────────────────────────────────────── */
.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-surface);
}
.detail-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}
.detail-tab:hover  { color: var(--color-text); }
.detail-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

/* ── Detail sections ─────────────────────────────────────── */
.detail-section {
  margin-bottom: var(--space-5);
}
.detail-section-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-dim);
  margin-bottom: var(--space-2);
}

/* ── Human/Agent field rows ──────────────────────────────── */
.field-human {
  background: var(--bg-human);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-human);
}
.field-agent {
  background: var(--bg-agent);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-agent);
  font-family: var(--font-mono);
}

/* ── Tollgate section ────────────────────────────────────── */
.tollgate-section {
  background: var(--bg-tollgate);
  border: 2px solid var(--border-tollgate);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.tollgate-title {
  font-weight: 700;
  font-size: var(--font-size-md);
  color: var(--border-tollgate);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.tollgate-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.tollgate-note {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  margin-top: var(--space-2);
}

/* ── Artifact card ───────────────────────────────────────── */
artifact-card {
  display: block;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}
.artifact-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.artifact-version {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-sm);
  padding: 1px 7px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  font-family: var(--font-mono);
}
.artifact-type {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-dim);
}
.artifact-date {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--color-muted);
}
.artifact-preview {
  font-size: var(--font-size-xs);
  color: var(--color-text-dim);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  background: var(--bg-surface-3);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.artifact-actions {
  display: flex;
  gap: var(--space-2);
}

/* ── Event timeline ──────────────────────────────────────── */
.event-list { display: flex; flex-direction: column; gap: var(--space-2); }
.event-item {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  font-size: var(--font-size-xs);
  background: var(--bg-surface-2);
}
.event-item.event-agent { border-left-color: var(--color-agent); }
.event-item.event-human { border-left-color: var(--color-human); }
.event-item.event-system { border-left-color: var(--color-muted); }
.event-icon { flex-shrink: 0; }
.event-content { flex: 1; }
.event-type { font-weight: 600; color: var(--color-text); }
.event-meta { color: var(--color-muted); margin-top: 1px; }

/* ── Spec markdown content ───────────────────────────────── */
.spec-content {
  font-size: var(--font-size-sm);
  line-height: 1.7;
  color: var(--color-text);
}
.spec-content h1, .spec-content h2, .spec-content h3 {
  margin: var(--space-4) 0 var(--space-2);
  color: var(--color-text);
}
.spec-content p { margin-bottom: var(--space-3); }
.spec-content code {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  background: var(--bg-surface-3);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
}
.spec-content pre {
  background: var(--bg-surface-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-3);
}
.spec-content pre code { background: none; padding: 0; }
.spec-info-banner {
  background: var(--bg-agent);
  color: var(--color-agent);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
  margin-bottom: var(--space-3);
}
