/* ============================================================
   Temporal Orchestration Cockpit — main.css
   ============================================================ */

:root {
  /* Palette */
  --bg:           #0a0e1a;
  --panel:        #111827;
  --panel-border: #1e293b;
  --text:         #e2e8f0;
  --text-muted:   #94a3b8;
  --text-dim:     #64748b;

  /* Semantic accents */
  --agent-violet:   #a855f7;
  --agent-magenta:  #ec4899;
  --infra-amber:    #f59e0b;
  --infra-gold:     #eab308;
  --market-cyan:    #06b6d4;
  --market-blue:    #3b82f6;
  --corpus-teal:    #14b8a6;
  --alert-orange:   #f97316;
  --alert-red:      #ef4444;
  --success-mint:   #34d399;

  /* Recency */
  --hot:   #ec4899;
  --fresh: #06b6d4;
  --warm:  #f59e0b;
  --stale: #475569;

  /* Glass */
  --glass-bg: rgba(17,24,39,0.85);
  --glass-blur: 12px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Radii */
  --r-card: 16px;
  --r-pill: 999px;
  --r-capsule: 20px;

  /* Fonts */
  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- App layout ---- */
#app {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  grid-template-rows: 1fr 180px;
  height: 100vh;
  gap: 0;
}

#left-rail {
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid var(--panel-border);
}

#central-canvas {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

#right-rail {
  grid-column: 3;
  grid-row: 1;
  border-left: 1px solid var(--panel-border);
  position: relative;
}

#bottom-dock {
  grid-column: 1 / -1;
  grid-row: 2;
  border-top: 1px solid var(--panel-border);
}

/* ---- Rails shared ---- */
.rail {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Graph SVG ---- */
#graph-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Glass panel mixin ---- */
.glass {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: var(--glass-bg);
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04),
              0 4px 24px rgba(10,14,26,0.6);
}

/* ---- Left Rail ---- */
.rail-header {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--panel-border);
}

.domain-cards {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2);
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}

.domain-card {
  background: rgba(17,24,39,0.6);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}

.domain-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-card);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  pointer-events: none;
}

.domain-card:hover {
  border-color: var(--text-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(10,14,26,0.5);
}

.domain-card.selected {
  border-color: var(--agent-violet);
  box-shadow: 0 0 12px rgba(168,85,247,0.15);
}

.domain-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

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

.domain-card-label {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.domain-card-badge {
  background: rgba(255,255,255,0.08);
  border-radius: var(--r-pill);
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.domain-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: var(--sp-1);
}

.sparkline-container {
  height: 20px;
  margin-top: var(--sp-1);
}

.sparkline-container svg {
  width: 100%;
  height: 100%;
}

/* ---- Command Launcher ---- */
.command-launcher {
  padding: var(--sp-3);
  border-top: 1px solid var(--panel-border);
}

.command-launcher-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--sp-2);
  padding-left: var(--sp-1);
}

.cmd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

.cmd-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.cmd-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 0 2px 2px 0;
}

.cmd-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10,14,26,0.4);
}

.cmd-btn[data-accent="violet"]::before { background: var(--agent-violet); }
.cmd-btn[data-accent="violet"]:hover { border-color: var(--agent-violet); box-shadow: 0 0 12px rgba(168,85,247,0.15); }

.cmd-btn[data-accent="cyan"]::before { background: var(--market-cyan); }
.cmd-btn[data-accent="cyan"]:hover { border-color: var(--market-cyan); box-shadow: 0 0 12px rgba(6,182,212,0.15); }

.cmd-btn[data-accent="amber"]::before { background: var(--infra-amber); }
.cmd-btn[data-accent="amber"]:hover { border-color: var(--infra-amber); box-shadow: 0 0 12px rgba(245,158,11,0.15); }

.cmd-btn[data-accent="teal"]::before { background: var(--corpus-teal); }
.cmd-btn[data-accent="teal"]:hover { border-color: var(--corpus-teal); box-shadow: 0 0 12px rgba(20,184,166,0.15); }

.cmd-btn[data-accent="blue"]::before { background: var(--market-blue); }
.cmd-btn[data-accent="blue"]:hover { border-color: var(--market-blue); box-shadow: 0 0 12px rgba(59,130,246,0.15); }

.cmd-btn[data-accent="mint"]::before { background: var(--success-mint); }
.cmd-btn[data-accent="mint"]:hover { border-color: var(--success-mint); box-shadow: 0 0 12px rgba(52,211,153,0.15); }

/* ---- Right Rail ---- */
.right-rail-inspector {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--panel-border);
  min-height: 0;
  max-height: 40%;
  overflow-y: auto;
}

.inspector-empty {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: var(--sp-5) var(--sp-3);
}

.inspector-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.inspector-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inspector-name {
  font-weight: 600;
  font-size: 14px;
}

.inspector-section {
  margin-bottom: var(--sp-3);
}

.inspector-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--sp-1);
}

.inspector-children {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.inspector-child-tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.inspector-child-tag:hover {
  background: rgba(255,255,255,0.12);
}

.inspector-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.inspector-action-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.inspector-action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* Filters row */
.activity-filters {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--panel-border);
  flex-wrap: wrap;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.filter-pill:hover {
  color: var(--text-muted);
  border-color: var(--text-dim);
}

.filter-pill.active {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: var(--text-dim);
}

/* Activity stream */
.activity-stream {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2);
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}

.activity-item {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 12px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.15s var(--ease);
  position: relative;
}

.activity-item:hover {
  background: rgba(255,255,255,0.03);
}

.activity-recency-bar {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-top-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 2px;
}

.activity-kind-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.activity-route {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.activity-timestamp {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ---- Bottom Dock ---- */
#bottom-dock {
  background: var(--panel);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.dock-timeline {
  padding: var(--sp-3) var(--sp-4) 0;
  position: relative;
}

.timeline-track {
  width: 100%;
  height: 32px;
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-border);
}

.timeline-density {
  position: absolute;
  bottom: 0;
  width: 1px;
  background: var(--text-dim);
  opacity: 0.4;
}

.timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--market-cyan);
  box-shadow: 0 0 8px rgba(6,182,212,0.4);
  z-index: 2;
  pointer-events: none;
}

.timeline-playhead {
  position: absolute;
  top: -4px;
  width: 12px;
  height: 40px;
  background: var(--market-cyan);
  border-radius: 3px;
  z-index: 3;
  cursor: grab;
  opacity: 0.9;
  transform: translateX(-6px);
}

.timeline-playhead:active { cursor: grabbing; }

.timeline-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.timeline-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  font-family: var(--font-ui);
}

.timeline-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.timeline-btn.active {
  background: rgba(6,182,212,0.15);
  border-color: var(--market-cyan);
  color: var(--market-cyan);
}

.timeline-time-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-left: var(--sp-2);
}

/* Dock bottom row */
.dock-bottom-row {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  align-items: stretch;
  overflow: hidden;
}

.metrics-strip {
  display: flex;
  gap: var(--sp-3);
  flex: 1;
}

.metric-card {
  flex: 1;
  min-width: 100px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  flex-direction: column;
  position: relative;
}

.metric-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.metric-sparkline {
  flex: 1;
  min-height: 24px;
}

.metric-sparkline svg {
  width: 100%;
  height: 100%;
}

.metric-tooltip {
  display: none;
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.metric-card:hover .metric-tooltip {
  display: block;
}

/* Orchestration controls */
.orch-controls {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.orch-panel {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: var(--sp-2) var(--sp-3);
  min-width: 110px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.orch-panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.orch-panel-status {
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.orch-panel-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.orch-panel-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

/* ---- Scrollbar styling ---- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ---- Graph node styles (SVG via CSS) ---- */
.graph-node {
  cursor: pointer;
  transition: opacity 0.25s var(--ease);
}

.graph-node text {
  fill: var(--text);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
}

.graph-node .node-glyph {
  font-size: 12px;
}

.graph-edge {
  fill: none;
  stroke: #334155;
  stroke-width: 1.2;
  transition: stroke 0.25s var(--ease), stroke-width 0.25s var(--ease);
}

.graph-edge.active {
  stroke-width: 2;
}

.graph-edge.preview {
  stroke-dasharray: 6 4;
}

.graph-packet {
  pointer-events: none;
}

/* Pulse animation */
@keyframes pulse-ring {
  0%   { r: 24; opacity: 0.6; }
  100% { r: 36; opacity: 0; }
}

.pulse-ring {
  animation: pulse-ring 2s var(--ease) infinite;
}

/* ---- Search Overlay (prefix-everywhere) ---- */
.search-overlay {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  justify-content: center;
  padding-top: var(--sp-5);
  transition: opacity 0.2s var(--ease);
}

.search-overlay.hidden { opacity: 0; }
.search-overlay.visible { opacity: 1; }

.search-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-capsule);
  padding: var(--sp-2) var(--sp-4);
  box-shadow: 0 8px 32px rgba(10,14,26,0.7), 0 0 0 1px rgba(255,255,255,0.04);
  min-width: 360px;
  max-width: 540px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-bar.has-matches {
  border-color: var(--agent-magenta);
  box-shadow: 0 8px 32px rgba(10,14,26,0.7), 0 0 20px rgba(236,72,153,0.1);
}

.search-prefix {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--agent-magenta);
  flex-shrink: 0;
}

.search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  caret-color: var(--agent-magenta);
}

.search-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

.search-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.search-hint {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Match highlight on domain cards */
.domain-card.search-match {
  border-color: var(--agent-magenta) !important;
  box-shadow: 0 0 16px rgba(236,72,153,0.2), inset 0 0 12px rgba(236,72,153,0.05) !important;
}

.domain-card.search-match .domain-card-label {
  color: var(--agent-magenta);
}

/* Match highlight on activity items */
.activity-item.search-match {
  background: rgba(236,72,153,0.06) !important;
  border-left: 2px solid var(--agent-magenta);
}

/* Active match (tab-focused) */
.domain-card.search-active {
  border-color: var(--market-cyan) !important;
  box-shadow: 0 0 20px rgba(6,182,212,0.25), inset 0 0 16px rgba(6,182,212,0.06) !important;
  transform: translateY(-2px) scale(1.02);
}

.activity-item.search-active {
  background: rgba(6,182,212,0.1) !important;
  border-left: 3px solid var(--market-cyan);
}

/* Match list panel (below search bar) */
.search-matches-panel {
  pointer-events: auto;
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 101;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-card);
  padding: var(--sp-2) 0;
  min-width: 380px;
  max-width: 540px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(10,14,26,0.8);
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}

.search-matches-panel.hidden { display: none; }

.search-match-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  transition: background 0.1s var(--ease);
  border-left: 3px solid transparent;
}

.search-match-item:hover {
  background: rgba(255,255,255,0.04);
}

.search-match-item.focused {
  background: rgba(6,182,212,0.1);
  border-left-color: var(--market-cyan);
}

.search-match-glyph {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.search-match-body {
  flex: 1;
  min-width: 0;
}

.search-match-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.search-match-context {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.search-match-kind {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Branching futures panel (right rail extension) */
.futures-panel {
  border-top: 1px solid var(--panel-border);
  padding: var(--sp-3);
  background: rgba(6,182,212,0.03);
}

.futures-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--market-cyan);
  margin-bottom: var(--sp-2);
}

.future-branch {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  margin-bottom: var(--sp-1);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s var(--ease);
  font-size: 11px;
}

.future-branch:hover {
  background: rgba(6,182,212,0.08);
}

.future-branch-icon {
  font-size: 12px;
  color: var(--market-cyan);
  flex-shrink: 0;
}

.future-branch-label {
  color: var(--text-muted);
  flex: 1;
}

.future-branch-prob {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ================================================================
   Search System — Command Line + Match Panel + Drill Panel + Dimming
   ================================================================ */

/* -- Command Line (top of central canvas) -- */
.search-command-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.search-command-line.focused {
  border-bottom-color: var(--panel-border);
  background: rgba(10,14,26,0.6);
}

.search-cmd-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  flex: 1;
  min-width: 0;
  caret-color: var(--agent-magenta);
  padding: var(--sp-1) 0;
}

.search-cmd-input::placeholder {
  color: var(--text-dim);
  font-weight: 300;
  opacity: 0.6;
}

.search-cmd-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: opacity 0.2s var(--ease);
}

/* -- Global Dimming Classes -- */

/* Search match boost */
.search-match-node {
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.search-dim-node {
  transition: opacity 0.3s var(--ease);
}

.search-match-edge {
  transition: opacity 0.3s var(--ease), stroke-width 0.3s var(--ease);
}

.search-dim-edge {
  transition: opacity 0.3s var(--ease);
}

/* Domain cards dim/match */
.domain-card.search-dim {
  opacity: 0.2;
  transition: opacity 0.3s var(--ease);
}

.domain-card.search-match {
  opacity: 1;
  border-color: var(--agent-magenta) !important;
  box-shadow: inset -3px 0 0 var(--agent-magenta), 0 0 16px rgba(236,72,153,0.12) !important;
  transition: all 0.3s var(--ease);
}

.domain-card.search-match .domain-card-label {
  color: var(--agent-magenta);
}

/* Activity items dim/match */
.activity-item.search-dim {
  opacity: 0.15;
  transition: opacity 0.3s var(--ease);
}

.activity-item.search-match {
  opacity: 1;
  background: rgba(236,72,153,0.04) !important;
  transition: all 0.3s var(--ease);
}

.activity-item.search-match .activity-recency-bar {
  box-shadow: 0 0 6px currentColor;
}

/* Metric cards dim/match */
.metric-card.search-dim-metric {
  opacity: 0.2;
  transition: opacity 0.3s var(--ease);
}

.metric-card.search-match-metric {
  opacity: 1;
  border-color: var(--market-cyan);
  box-shadow: 0 0 8px rgba(6,182,212,0.15);
  transition: all 0.3s var(--ease);
}

/* -- Match Panel (slides from left of central canvas) -- */
.search-match-panel {
  position: absolute;
  top: 48px;
  left: 0;
  width: 320px;
  bottom: 0;
  z-index: 40;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--panel-border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
  transform: translateX(0);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.search-match-panel.hidden {
  transform: translateX(-320px);
  opacity: 0;
  pointer-events: none;
}

.match-panel-header {
  padding: var(--sp-3) var(--sp-4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--agent-magenta);
  border-bottom: 1px solid var(--panel-border);
  font-family: var(--font-mono);
}

.match-group-header {
  padding: var(--sp-2) var(--sp-4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--panel-border);
  margin-top: var(--sp-1);
}

.match-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  transition: background 0.15s var(--ease);
  border-left: 3px solid transparent;
  font-size: 12px;
}

.match-row:hover {
  background: rgba(255,255,255,0.04);
}

.match-row.focused {
  background: rgba(6,182,212,0.1);
  border-left-color: var(--market-cyan);
}

.match-row-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.match-row-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-weight: 500;
}

.match-row-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.match-row-recency {
  font-size: 9px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* -- Drill Panel (overlays right rail) -- */
.search-drill-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--panel);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.search-drill-panel.hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.search-drill-panel.visible {
  transform: translateX(0);
  opacity: 1;
}

.drill-header {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--panel-border);
  position: relative;
}

.drill-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.drill-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.drill-title-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.drill-recency-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.drill-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.drill-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 11px;
}

.drill-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drill-status {
  color: var(--text-muted);
}

.drill-recency-label {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: auto;
}

.drill-section {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--panel-border);
}

.drill-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--sp-2);
}

.drill-context {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.drill-ctx-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: 12px;
}

.drill-ctx-label {
  color: var(--text-dim);
  font-size: 11px;
  min-width: 55px;
  flex-shrink: 0;
}

.drill-ctx-value {
  color: var(--text-muted);
}

.drill-ctx-value.clickable,
.drill-child-tag.clickable {
  cursor: pointer;
  color: var(--market-cyan);
  transition: color 0.15s var(--ease);
}

.drill-ctx-value.clickable:hover,
.drill-child-tag.clickable:hover {
  color: var(--text);
}

.drill-child-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  margin: 1px 2px;
}

.drill-connected-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.drill-event-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
  font-size: 11px;
}

.drill-event-bar {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

.drill-event-kind {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

.drill-event-summary {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Future Branches in Drill */
.drill-branches {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.drill-branch {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.drill-branch:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--text-dim);
}

.drill-branch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-1);
}

.drill-branch-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
}

.drill-branch-likelihood {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
}

.drill-branch-likelihood.likely {
  background: rgba(52,211,153,0.15);
  color: #34d399;
}

.drill-branch-likelihood.possible {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}

.drill-branch-likelihood.unlikely {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

.drill-branch-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: var(--sp-2);
}

.drill-branch-confidence {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.drill-branch-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.drill-branch-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}

.drill-branch-pct {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  min-width: 28px;
  text-align: right;
}

.drill-branch-action {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  width: 100%;
  text-align: center;
}

.drill-branch-action:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border-color: var(--text-dim);
}

/* Orchestrate action buttons row */
.drill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.drill-action-btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.drill-action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border-color: var(--text-dim);
}

/* Ghost preview */
.ghost-preview-group {
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

/* Search glow/cursor rings */
.search-glow-ring,
.search-cursor-ring {
  pointer-events: none;
}

/* ---- Utility ---- */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
