/* HearthNet Visualizer — Warm Editorial */

/* ───────────────────────────────────────
   Design Tokens
   ─────────────────────────────────────── */
:root {
  /* Warm charcoal surfaces — tinted toward amber (hue ~50) */
  --bg-void:     oklch(10% 0.008 55);
  --bg:          oklch(13% 0.008 55);
  --bg-raised:   oklch(16% 0.007 55);
  --bg-surface:  oklch(19% 0.006 55);
  --bg-hover:    oklch(21% 0.008 55);
  --bg-active:   oklch(24% 0.010 55);

  /* Borders — warm tint */
  --border:      oklch(26% 0.010 55);
  --border-dim:  oklch(21% 0.008 55);
  --border-focus:oklch(34% 0.015 55);

  /* Text — warm off-whites */
  --text:        oklch(78% 0.010 60);
  --text-dim:    oklch(55% 0.015 55);
  --text-muted:  oklch(50% 0.012 55);
  --text-bright: oklch(90% 0.008 60);
  --text-white:  oklch(95% 0.005 60);

  /* Brand — amber/hearth */
  --brand:       #c49a4a;
  --brand-dim:   oklch(50% 0.08 55);

  /* Agent palette — desaturated, distinctive, no neon */
  --agent-user:   #c8884a;
  --agent-rupert: #5b8fbf;
  --agent-jeeves: #5ea87a;
  --agent-dewey:  #9578b5;
  --agent-darcy:  #bf6878;
  --agent-percy:  #5ba0ad;
  --agent-system: oklch(45% 0.010 55);

  /* Event type accents — functional, not decorative */
  --type-task:          #5b8fbf;
  --type-response:      #5ea87a;
  --type-execute:       #c8a44a;
  --type-execute_result:#7aad5e;
  --type-resolution:    #9578b5;
  --type-conflict:      #c45454;
  --type-rejection:     #c45454;
  --type-lease:         #bf8840;
  --type-lease_request: #c8a44a;
  --type-lease_grant:   #5ea87a;
  --type-lease_denied:  #c45454;
  --type-event:         oklch(45% 0.010 55);

  /* Radii — sharper, more editorial */
  --radius-sm:  3px;
  --radius:     5px;
  --radius-pill:100px;

  /* Fonts */
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'SF Mono', monospace;
  --font-display: 'DM Sans', system-ui, sans-serif;

  /* Motion — quart-out, no bounce */
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --transition: 150ms cubic-bezier(0.25, 1, 0.5, 1);
}

/* ───────────────────────────────────────
   Site Nav (shared across all pages)
   ─────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

.site-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-white);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav-link {
  padding: 6px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: var(--radius);
  transition: var(--transition);
}

.site-nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.site-nav-link.active {
  color: var(--text-bright);
  background: var(--bg-surface);
}

/* ─── Global Focus ─── */
*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ───────────────────────────────────────
   Reset & Base
   ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-void);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ───────────────────────────────────────
   Header
   ─────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

/* ─── Agent Roster ─── */
.header-center {
  display: flex;
  align-items: center;
}

.agent-roster {
  display: flex;
  gap: 4px;
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border-dim);
  transition: var(--transition);
  cursor: default;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: var(--transition);
}

.chip-name {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  transition: var(--transition);
}

.chip-role {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0;
}

/* Agent colors */
.agent-chip[data-agent="user"]   .chip-dot { background: var(--agent-user); }
.agent-chip[data-agent="rupert"] .chip-dot { background: var(--agent-rupert); }
.agent-chip[data-agent="jeeves"] .chip-dot { background: var(--agent-jeeves); }
.agent-chip[data-agent="darcy"]  .chip-dot { background: var(--agent-darcy); }
.agent-chip[data-agent="dewey"]  .chip-dot { background: var(--agent-dewey); }

.agent-chip[data-agent="user"]   .chip-name { color: var(--agent-user); }
.agent-chip[data-agent="rupert"] .chip-name { color: var(--agent-rupert); }
.agent-chip[data-agent="jeeves"] .chip-name { color: var(--agent-jeeves); }
.agent-chip[data-agent="darcy"]  .chip-name { color: var(--agent-darcy); }
.agent-chip[data-agent="dewey"]  .chip-name { color: var(--agent-dewey); }

/* Active state — solid border, no glow */
.agent-chip.active {
  border-color: var(--border-focus);
  background: var(--bg-hover);
}

.agent-chip[data-agent="user"].active   { border-color: var(--agent-user); }
.agent-chip[data-agent="rupert"].active { border-color: var(--agent-rupert); }
.agent-chip[data-agent="jeeves"].active { border-color: var(--agent-jeeves); }
.agent-chip[data-agent="darcy"].active  { border-color: var(--agent-darcy); }
.agent-chip[data-agent="dewey"].active  { border-color: var(--agent-dewey); }

/* ─── Status Cluster ─── */
.status-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border-dim);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
}

.pill-label {
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 9px;
}

.pill-value {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
}

.live-indicator {
  position: relative;
  width: 10px;
  height: 10px;
  margin-left: 2px;
}

.live-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--brand);
  opacity: 0;
  animation: live-ring 3s ease-out infinite;
}

.live-core {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--brand);
  animation: live-pulse 3s ease-in-out infinite;
}

@keyframes live-ring {
  0%   { opacity: 0.5; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(2.2); }
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ───────────────────────────────────────
   Toolbar
   ─────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 42px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}

/* ─── Primary Mode Tabs ─── */
.mode-tabs {
  display: flex;
  gap: 2px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 700;
  transition: var(--transition);
  white-space: nowrap;
}

.mode-tab:hover {
  background: var(--bg-hover);
  color: var(--text-dim);
}

.mode-tab.active {
  background: var(--bg-active);
  color: var(--text-bright);
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-mode-dot {
  background: var(--brand);
  animation: live-pulse 3s ease-in-out infinite;
}

.mode-tab.active .live-mode-dot {
  background: var(--type-lease_grant);
}

.mode-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.mode-tab.active .mode-icon {
  opacity: 1;
}

.mode-label {
  pointer-events: none;
}

/* Divider between mode tabs and scene tabs */
.mode-tabs + .scene-tabs::before,
.mode-tabs + .toolbar-right::before {
  display: none;
}

/* ─── Scene Sub-Tabs (replay mode) ─── */
.scene-tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.scene-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.scene-tab:hover {
  background: var(--bg-hover);
  color: var(--text-dim);
}

.scene-tab.active {
  background: var(--bg-active);
  color: var(--text-bright);
}

.tab-key {
  font-weight: 700;
}

.tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 3px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: var(--transition);
}

.scene-tab.active .tab-num {
  background: var(--brand);
  color: oklch(15% 0.01 55);
}

.tab-label {
  font-size: 12px;
}

/* ─── Toolbar Right (live mode) ─── */
.toolbar-right {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.tool-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ───────────────────────────────────────
   Main Layout
   ─────────────────────────────────────── */
main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.timeline-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ───────────────────────────────────────
   Timeline
   ─────────────────────────────────────── */
.timeline {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 48px 16px;
  scroll-behavior: smooth;
}

/* ─── Commit Rows ─── */
.commit-node {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 150ms var(--ease-out);
  position: relative;
  border-left: 3px solid transparent;
}

.commit-node:hover {
  background: var(--bg-hover);
}

.commit-node.selected {
  background: var(--bg-active);
}

/* Agent accent — always visible via left border */
.commit-node[data-agent="user"]   { border-left-color: color-mix(in srgb, var(--agent-user) 30%, transparent); }
.commit-node[data-agent="rupert"] { border-left-color: color-mix(in srgb, var(--agent-rupert) 30%, transparent); }
.commit-node[data-agent="jeeves"] { border-left-color: color-mix(in srgb, var(--agent-jeeves) 30%, transparent); }
.commit-node[data-agent="darcy"]  { border-left-color: color-mix(in srgb, var(--agent-darcy) 30%, transparent); }
.commit-node[data-agent="dewey"]  { border-left-color: color-mix(in srgb, var(--agent-dewey) 30%, transparent); }
.commit-node[data-agent="percy"]  { border-left-color: color-mix(in srgb, var(--agent-percy) 30%, transparent); }
.commit-node[data-agent="system"] { border-left-color: color-mix(in srgb, var(--agent-system) 30%, transparent); }

/* Selected — stronger left accent */
.commit-node.selected[data-agent="user"]   { border-left-color: var(--agent-user); }
.commit-node.selected[data-agent="rupert"] { border-left-color: var(--agent-rupert); }
.commit-node.selected[data-agent="jeeves"] { border-left-color: var(--agent-jeeves); }
.commit-node.selected[data-agent="darcy"]  { border-left-color: var(--agent-darcy); }
.commit-node.selected[data-agent="dewey"]  { border-left-color: var(--agent-dewey); }
.commit-node.selected[data-agent="percy"]  { border-left-color: var(--agent-percy); }
.commit-node.selected[data-agent="system"] { border-left-color: var(--agent-system); }

/* EVENT HIERARCHY — dramatic events get persistent visual treatment */
.commit-node[data-type="conflict"],
.commit-node[data-type="rejection"] {
  background: color-mix(in srgb, var(--type-conflict) 6%, var(--bg));
  border-left-color: var(--type-conflict) !important;
}

.commit-node[data-type="conflict"]:hover,
.commit-node[data-type="rejection"]:hover {
  background: color-mix(in srgb, var(--type-conflict) 10%, var(--bg));
}

.commit-node[data-type="resolution"] {
  background: color-mix(in srgb, var(--type-resolution) 4%, var(--bg));
  border-left-color: var(--type-resolution) !important;
}

.commit-node[data-type="lease_grant"] {
  border-left-color: var(--type-lease_grant) !important;
}

.commit-node[data-type="lease_denied"] {
  background: color-mix(in srgb, var(--type-rejection) 5%, var(--bg));
  border-left-color: var(--type-rejection) !important;
}

/* Timeline spine */
.commit-node::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 30px;
  bottom: -8px;
  width: 1px;
  background: var(--border-dim);
}

.commit-node:last-child::before {
  display: none;
}

/* Agent dot */
.commit-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  z-index: 1;
  border: 2px solid var(--bg-void);
}

.commit-dot[data-agent="user"]   { background: var(--agent-user); }
.commit-dot[data-agent="rupert"] { background: var(--agent-rupert); }
.commit-dot[data-agent="jeeves"] { background: var(--agent-jeeves); }
.commit-dot[data-agent="dewey"]  { background: var(--agent-dewey); }
.commit-dot[data-agent="darcy"]  { background: var(--agent-darcy); }
.commit-dot[data-agent="percy"]  { background: var(--agent-percy); }
.commit-dot[data-agent="system"] { background: var(--agent-system); }

/* Commit body */
.commit-body {
  flex: 1;
  min-width: 0;
}

.commit-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.commit-hash {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.commit-author {
  font-size: 13.5px;
  font-weight: 800;
  text-transform: capitalize;
  letter-spacing: -0.2px;
}

.commit-author[data-agent="user"]   { color: var(--agent-user); }
.commit-author[data-agent="rupert"] { color: var(--agent-rupert); }
.commit-author[data-agent="jeeves"] { color: var(--agent-jeeves); }
.commit-author[data-agent="dewey"]  { color: var(--agent-dewey); }
.commit-author[data-agent="darcy"]  { color: var(--agent-darcy); }
.commit-author[data-agent="percy"]  { color: var(--agent-percy); }
.commit-author[data-agent="system"] { color: var(--agent-system); }

.commit-arrow {
  font-size: 10px;
  color: var(--text-muted);
}

.commit-target {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.commit-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
  font-family: var(--font-mono);
  font-weight: 400;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.commit-subject {
  font-size: 14px;
  color: var(--text-bright);
  font-weight: 400;
  line-height: 1.5;
  word-break: break-word;
}

/* ─── Type Badges ─── */
.type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 3px;
  line-height: 1;
  white-space: nowrap;
}

.type-badge.task           { background: color-mix(in srgb, var(--type-task) 15%, transparent);          color: var(--type-task); }
.type-badge.response       { background: color-mix(in srgb, var(--type-response) 15%, transparent);      color: var(--type-response); }
.type-badge.execute        { background: color-mix(in srgb, var(--type-execute) 15%, transparent);       color: var(--type-execute); }
.type-badge.execute_result { background: color-mix(in srgb, var(--type-execute_result) 12%, transparent);color: var(--type-execute_result); }
.type-badge.resolution     { background: color-mix(in srgb, var(--type-resolution) 15%, transparent);    color: var(--type-resolution); }
.type-badge.conflict       { background: color-mix(in srgb, var(--type-conflict) 18%, transparent);      color: var(--type-conflict); font-weight: 800; }
.type-badge.rejection      { background: color-mix(in srgb, var(--type-rejection) 18%, transparent);     color: var(--type-rejection); font-weight: 800; }
.type-badge.lease          { background: color-mix(in srgb, var(--type-lease) 15%, transparent);         color: var(--type-lease); }
.type-badge.lease_request  { background: color-mix(in srgb, var(--type-lease_request) 12%, transparent); color: var(--type-lease_request); }
.type-badge.lease_grant    { background: color-mix(in srgb, var(--type-lease_grant) 15%, transparent);   color: var(--type-lease_grant); }
.type-badge.lease_denied   { background: color-mix(in srgb, var(--type-rejection) 18%, transparent);     color: var(--type-rejection); font-weight: 800; }
.type-badge.event          { background: color-mix(in srgb, var(--type-event) 12%, transparent);         color: var(--type-event); }

/* ─── Scene Separators — bold landmarks ─── */
.scene-separator {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 32px 0 14px 0;
  margin-top: 12px;
}

.scene-separator-label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--brand);
  white-space: nowrap;
}

.scene-separator-line {
  flex: 1;
  height: 2px;
  background: color-mix(in srgb, var(--brand) 25%, var(--border));
}

/* ─── Animations ─── */
.commit-node {
  animation: node-enter 200ms var(--ease-out) both;
}

@keyframes node-enter {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
}

.commit-node.new-commit {
  animation: node-appear 400ms var(--ease-out) both;
}

@keyframes node-appear {
  0% {
    opacity: 0;
    transform: translateX(-8px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Conflict/rejection row pulse on first appearance */
.commit-node.new-commit[data-type="conflict"],
.commit-node.new-commit[data-type="rejection"],
.commit-node.new-commit[data-type="lease_denied"] {
  animation: conflict-appear 600ms var(--ease-out) both;
}

@keyframes conflict-appear {
  0% {
    opacity: 0;
    transform: translateX(-8px);
    border-left-color: var(--type-conflict);
    background: color-mix(in srgb, var(--type-conflict) 18%, var(--bg));
  }
  40% {
    opacity: 1;
    transform: translateX(0);
    background: color-mix(in srgb, var(--type-conflict) 14%, var(--bg));
  }
  100% {
    background: color-mix(in srgb, var(--type-conflict) 6%, var(--bg));
  }
}

/* Scene separator entrance */
.scene-separator {
  animation: scene-enter 500ms var(--ease-out) both;
}

@keyframes scene-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.scene-separator-line {
  animation: line-draw 600ms 150ms var(--ease-out) both;
  transform-origin: left;
}

@keyframes line-draw {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* Detail panel content crossfade */
.detail-content {
  animation: detail-fade-in 200ms var(--ease-out) both;
}

@keyframes detail-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ───────────────────────────────────────
   Detail Panel
   ─────────────────────────────────────── */
.detail-panel {
  width: 380px;
  border-left: 1px solid var(--border);
  background: var(--bg-raised);
  overflow-y: auto;
  flex-shrink: 0;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}

.detail-empty p {
  font-size: 13px;
  font-weight: 300;
}

/* Detail content layout */
.detail-content {
  padding: 20px;
}

/* Flow diagram — hero element, must read clearly on video */
.detail-flow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 16px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, var(--bg-active));
  border-radius: var(--radius);
}

.flow-agent {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  text-transform: capitalize;
  letter-spacing: -0.3px;
}

.flow-arrow {
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
}

.flow-type-badge {
  margin-left: auto;
}

/* Detail header — compact */
.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.detail-agent-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-body);
  color: oklch(15% 0.01 55);
}

.detail-header-text h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}

.detail-header-text .detail-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 300;
}

/* Metadata row — compact, horizontal */
.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 3px;
}

.meta-item .meta-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 9.5px;
}

.meta-item .meta-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

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

.detail-section-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.detail-field {
  margin-bottom: 8px;
}

.detail-field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-field .value {
  font-size: 14px;
  color: var(--text-bright);
  font-weight: 400;
  line-height: 1.55;
  word-break: break-word;
}

.detail-field .value.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  background: var(--bg);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}

/* ───────────────────────────────────────
   Scrollbar
   ─────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ───────────────────────────────────────
   Empty / Loading
   ─────────────────────────────────────── */
.timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 300;
}

.timeline-empty .spin {
  animation: spin 6s linear infinite;
  opacity: 0.2;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ───────────────────────────────────────
   Topology Graph Panel
   ─────────────────────────────────────── */
.topo-panel {
  width: 320px;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.topo-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-dim);
}

.topo-title {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

#topo-svg {
  flex: 1;
  width: 100%;
  padding: 8px;
}

/* Animated edge path */
path.topo-edge {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
  animation: topo-edge-in 600ms var(--ease-out) forwards;
}

/* Animated arrowhead */
polygon.topo-edge {
  stroke: none;
  opacity: 0;
  animation: topo-edge-in 600ms var(--ease-out) forwards;
}

@keyframes topo-edge-in {
  0%   { opacity: 0; stroke-dashoffset: 100; }
  30%  { opacity: 0.9; }
  100% { opacity: 0.5; stroke-dashoffset: 0; }
}

.topo-edge-fade {
  animation: topo-edge-fade 1500ms ease-out forwards;
}

@keyframes topo-edge-fade {
  0%   { opacity: 0.5; }
  100% { opacity: 0.08; }
}

/* Active agent pulse */
.topo-agent-active {
  animation: topo-pulse 600ms var(--ease-out);
}

@keyframes topo-pulse {
  0%   { opacity: 0.2; }
  30%  { opacity: 0.6; }
  100% { opacity: 0.2; }
}

/* Edge arrowhead marker */
.topo-arrowhead {
  fill: currentColor;
}

/* Action label on edge */
.topo-label {
  font-size: 7.5px;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  fill: var(--text-dim);
  opacity: 0;
  animation: topo-label-in 400ms 100ms var(--ease-out) forwards;
}

@keyframes topo-label-in {
  from { opacity: 0; }
  to   { opacity: 0.8; }
}

.topo-label-fade {
  animation: topo-label-fade 1500ms ease-out forwards !important;
}

@keyframes topo-label-fade {
  from { opacity: 0.8; }
  to   { opacity: 0; }
}

/* ───────────────────────────────────────
   Replay Bar
   ─────────────────────────────────────── */
.replay-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.replay-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.replay-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}

.replay-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 14px;
  background: var(--brand);
  border-color: var(--brand);
  color: oklch(15% 0.01 55);
}

.replay-play:hover {
  background: oklch(65% 0.12 55);
  border-color: oklch(65% 0.12 55);
  color: oklch(15% 0.01 55);
}

.replay-play.playing {
  background: var(--type-conflict);
  border-color: var(--type-conflict);
}

.replay-exit {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 14px;
}

.replay-progress {
  flex: 1;
  padding: 0 8px;
}

.replay-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  /* Filled track via gradient — updated by JS via --progress */
  --progress: 100%;
  background: linear-gradient(
    to right,
    var(--brand) 0%,
    var(--brand) var(--progress),
    var(--border) var(--progress),
    var(--border) 100%
  );
  transition: --progress 80ms linear;
}

.replay-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.replay-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
}

.replay-slider::-moz-range-progress {
  background: var(--brand);
  border-radius: 3px;
  height: 6px;
}

.replay-speed {
  display: flex;
  align-items: center;
  gap: 4px;
}

.replay-speed label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.replay-speed select {
  background: var(--bg);
  border: 1px solid var(--border-dim);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.replay-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: center;
}

/* ───────────────────────────────────────
   Reduced Motion
   ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ───────────────────────────────────────
   Responsive
   ─────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-panel {
    display: none;
  }
  .topo-panel {
    display: none;
  }
  .tab-label {
    display: none;
  }
  .subtitle {
    display: none;
  }
}
