/* ===== Right Panel (Detail) =====
   The detail panel's shell (`.detail-panel / -panel.collapsed`,
   `.detail-header`, `.detail-title`, `.detail-close`,
   `.detail-header-actions`) was part of the legacy `_right-sidebar.html`
   template that AppShell no longer injects — the right rail is now
   `components/right-sidebar/right-sidebar.tsx` with Tailwind
   utilities + the shared `nav-classes.ts` constants. Those rules and
   the matching `.app:has(#detailPanel.collapsed) #detailResize`
   override are dead and have been removed.

   What remains here is the *body* of the detail view, which is still
   produced as raw innerHTML strings by `public/js/shared/ui.js`
   (`renderDetail()`) and the execution-tree renderer in
   `public/js/chat/tree-render.js`. The classes below match the
   class names those scripts emit, so they have to stay as global
   stylesheet rules until the renderers themselves move to React. */

.detail-body {
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.detail-section { margin-bottom: 16px; }

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

/* `.detail-field` / `.detail-field-label` were originally wrappers for
   labelled field rows in the detail view; `ui.js::renderDetail()` no
   longer emits `<div class="detail-field"><div class="detail-field-label">…`
   pairs, so the wrapper + label rules are dead. The `.detail-field-value`
   is still emitted (path + expose rows), so its rule stays. */

.detail-field-value {
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  word-break: break-all;
}

.detail-code {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.5;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.detail-badge.running { background: rgba(97,175,239,0.12); color: var(--accent-blue); }
.detail-badge.paused { background: rgba(229,192,123,0.12); color: var(--accent-yellow); }
.detail-badge.success { background: rgba(152,195,121,0.12); color: var(--accent-green); }
.detail-badge.error { background: rgba(224,108,117,0.12); color: var(--accent-red); }

/* ===== Inline tree node styles ===== */
.tree-node { animation: nodeAppear 0.3s ease forwards; }

@keyframes nodeAppear {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.node-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
  font-size: 14px;
  overflow: hidden;
}

.node-row:hover { background: var(--bg-hover); }
.node-row.selected { background: rgba(97,175,239,0.1); }

.node-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.node-toggle.expanded { transform: rotate(90deg); }
.node-toggle.leaf { visibility: hidden; }

.node-icon { font-size: 12px; flex-shrink: 0; width: 16px; text-align: center; }
.node-name { font-family: var(--font-mono); font-size: 12px; color: var(--text-bright); font-weight: 500; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-name:hover { text-decoration: underline; }
.node-status { font-size: 12px; padding: 0 5px; border-radius: 3px; flex-shrink: 0; }
.node-status.running { background: rgba(97,175,239,0.12); color: var(--accent-blue); }
.node-status.paused { background: rgba(229,192,123,0.12); color: var(--accent-yellow); }
.node-status.success { background: rgba(152,195,121,0.12); color: var(--accent-green); }
.node-status.error { background: rgba(224,108,117,0.12); color: var(--accent-red); }
.node-status.cancelled { background: rgba(128,128,128,0.14); color: var(--text-muted); }
.node-duration { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.node-output-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.node-output-preview.exec-preview { font-family: var(--font-mono); color: var(--text-muted); }

.llm-badge {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.4px;
  padding: 1px 6px; border-radius: 3px;
  background: rgba(198,144,38,0.12); color: var(--accent-yellow);
  flex-shrink: 0; line-height: 1.3;
}

.rerun-btn {
  -webkit-appearance: none; appearance: none;
  padding: 0 12px; height: 28px; line-height: 28px; font-size: 12px;
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-secondary); cursor: pointer; font-family: var(--font-sans);
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 !important; box-sizing: border-box;
}
.rerun-btn:hover { color: var(--accent-blue); border-color: var(--accent-blue); }

/* Inline retry panel in execution tree */
.retry-icon {
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  flex-shrink: 0; padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--border); background: var(--bg-tertiary);
  opacity: 0; transition: opacity 0.15s;
}
.node-row:hover .retry-icon { opacity: 1; }
.retry-icon:hover { color: var(--accent-blue); border-color: var(--accent-blue); background: rgba(97,175,239,0.08); }

.retry-panel {
  margin: 4px 0 4px 36px; padding: 8px 10px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 12px;
}
.retry-field { margin-bottom: 8px; }
.retry-field-label {
  display: block; font-size: 12px; color: var(--accent-cyan);
  font-family: var(--font-mono); margin-bottom: 3px; font-weight: 600;
}
.retry-field-group {
  border-left: 2px solid var(--border); padding-left: 24px; margin-top: 2px;
}
.retry-field-input {
  width: 100%; background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; font-family: var(--font-mono); font-size: 12px;
}
textarea.retry-field-input { min-height: 50px; max-height: 200px; resize: vertical; }
.retry-field-input:focus { outline: none; border-color: var(--accent-blue); }
.retry-panel-actions { display: flex; gap: 6px; margin-top: 2px; }
.retry-panel-actions button {
  padding: 4px 12px; font-size: 12px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--border); font-family: var(--font-sans);
}
/* Retry-panel buttons: same idle-neutral / amber-on-hover philosophy
   as the rest of the product. Was solid orange + white text — read as
   the single loudest control on the page. The cancel button already
   followed this pattern, the exec button was the outlier. */
.retry-exec-btn {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}
.retry-exec-btn:hover {
  background: color-mix(in srgb, var(--accent-orange) 18%, transparent);
  color: var(--accent-orange);
  border-color: color-mix(in srgb, var(--accent-orange) 30%, transparent);
}
.retry-cancel-btn { background: var(--bg-hover); color: var(--text-secondary); }
.retry-cancel-btn:hover { color: var(--text-primary); }

/* Vertical guide line column aligns with the parent ▶/▼ toggle's
 * visual center: ``.node-row`` padding-left is 6px, ``.node-toggle``
 * is 16px wide → toggle centre lives at 6 + 8 = 14px from the
 * ``.tree-node`` left edge. With margin-left:13 + 1px border, the
 * guide line sits at column 13–14 — flush with the toggle centre. */
.node-children {
  margin-left: 13px;
  border-left: 1px solid var(--border);
  padding-left: 9px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.node-children.collapsed { max-height: 0; overflow: hidden; }

/* The legacy ``.pulse`` class + ``pulse`` keyframes used to drive
   the inline-tree-header ``●`` glyph; that surface now uses
   .indicator-dot pulse-opacity, defined in chat.css. */

