/* The Neural Map (Rebirth §7). Colours only from :root tokens; the canvas draws with the same
   tokens, read at runtime. The map is the product's one bold surface; the chrome around it stays quiet. */

.neural-screen { display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 150px); min-height: 520px; }
.neural-loading { padding: 20px; max-width: 720px; }
.neural-banner { padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--yellow) 40%, transparent); }

.neural-toolbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.neural-search { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px; background: var(--fill); box-shadow: inset 0 0 0 1px var(--sep); }
.neural-search input { width: 220px; border: 0; background: none; color: var(--text); font: 13px var(--font); outline: none; }
.neural-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.neural-hits { position: absolute; top: 38px; left: 0; z-index: 20; min-width: 300px; margin: 0; padding: 4px; list-style: none; border-radius: 10px;
  background: var(--surface); box-shadow: 0 12px 32px color-mix(in srgb, black 40%, transparent), 0 0 0 1px var(--sep-strong); }
.neural-hits button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer; }
.neural-hits button:hover, .neural-hits button:focus-visible { background: var(--accent-fill); outline: none; }
.neural-hits span { font-size: 11.5px; color: var(--text-3); }
.neural-counts { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.neural-counts:last-child { margin-left: auto; }

.neural-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.neural-chip { height: 24px; padding: 0 9px; border: 0; border-radius: 999px; font: 600 11.5px var(--font); color: var(--text-2); background: var(--fill); cursor: pointer; }
.neural-chip.is-on { color: var(--text); background: var(--accent-fill); box-shadow: inset 0 0 0 1px var(--accent); }
.neural-sep { width: 1px; height: 16px; background: var(--sep); margin: 0 4px; }

.neural-body { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; }
.neural-host { position: relative; min-height: 0; border-radius: 14px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--accent) 7%, var(--bg)), var(--bg) 70%); box-shadow: inset 0 0 0 1px var(--sep); }
.neural-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.neural-labels { cursor: grab; touch-action: none; }

.neural-rail { display: flex; flex-direction: column; min-height: 0; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--sep); }
.neural-rail h3 { margin: 0; padding: 10px 12px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); box-shadow: inset 0 -1px 0 var(--sep); }
.neural-rail ol { flex: 1; margin: 0; padding: 4px; list-style: none; overflow-y: auto; }
.neural-row button { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 7px; background: none; color: var(--text); font: 12px var(--font); text-align: left; cursor: pointer; }
.neural-row button:hover { background: var(--fill); }
.neural-verb { grid-row: span 2; align-self: start; min-width: 44px; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700; color: var(--teal); background: var(--fill); }
.neural-row.is-write .neural-verb { color: var(--orange); } .neural-row.is-call .neural-verb { color: var(--accent-text); }
.neural-row.is-outbound .neural-verb, .neural-row.is-spend .neural-verb { color: var(--yellow); }
.neural-row.is-fail .neural-verb, .neural-row.is-destructive .neural-verb { color: var(--red); }
.neural-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neural-when { font-size: 11px; color: var(--text-3); }
.neural-row small { grid-column: 2; font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neural-empty { padding: 14px; font-size: 12.5px; color: var(--text-3); }

.neural-inspector { position: absolute; top: 0; right: 310px; bottom: 0; width: min(360px, 44%); z-index: 10; display: flex; flex-direction: column; gap: 10px; padding: 14px;
  overflow-y: auto; border-radius: 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px color-mix(in srgb, black 40%, transparent), 0 0 0 1px var(--sep-strong); }
.neural-inspector header { display: flex; align-items: flex-start; gap: 8px; }
.neural-inspector header div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.neural-inspector header b { font-size: 16px; }
.neural-inspector header span, .neural-source span { font-size: 11.5px; color: var(--text-3); }
.neural-inspector h4 { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.neural-what { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text); }
.neural-state { font-size: 12px; font-weight: 600; color: var(--text-2); }
.neural-state.is-active { color: var(--green); } .neural-state.is-error { color: var(--red); }
.neural-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.neural-stats div { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 8px; background: var(--fill); }
.neural-stats span { font-size: 10.5px; color: var(--text-3); } .neural-stats b { font-size: 14px; font-variant-numeric: tabular-nums; }
.neural-error { padding: 6px 8px; border-radius: 8px; font-size: 12px; color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.neural-source { display: flex; flex-direction: column; gap: 2px; } .neural-source code { font-size: 11.5px; overflow-wrap: anywhere; }
.neural-mini { margin: 0; padding: 0; list-style: none; }
.neural-mini button { display: flex; flex-direction: column; width: 100%; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 12px var(--font); text-align: left; cursor: pointer; }
.neural-mini button:hover { background: var(--fill); } .neural-mini small { color: var(--text-3); }

.neural-trace ol { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.neural-trace li { display: grid; grid-template-columns: 1fr; gap: 2px; }
.neural-span-label { font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neural-bar { position: relative; height: 6px; border-radius: 3px; background: var(--fill); }
.neural-bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--l); width: var(--w); border-radius: 3px; background: var(--teal); }
.neural-bar.is-write::after { background: var(--orange); } .neural-bar.is-call::after { background: var(--accent); } .neural-bar.is-fail::after { background: var(--red); }

.neural-activity { overflow-y: auto; min-height: 0; padding: 10px 12px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--sep); font-size: 13px; }
.neural-activity summary { cursor: pointer; padding: 4px 0; font-weight: 600; } .neural-activity summary span { font-weight: 400; color: var(--text-3); font-size: 12px; }
.neural-activity details details { margin-left: 14px; } .neural-activity ul { margin: 2px 0 6px 14px; padding: 0; list-style: none; }
.neural-activity li { padding: 2px 0; color: var(--text-2); }
.neural-activity li button { border: 0; background: none; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; }

.neural-hover { position: fixed; z-index: 50; max-width: 300px; padding: 8px 10px; border-radius: 10px; pointer-events: none; font-size: 12px;
  background: var(--surface); box-shadow: 0 10px 28px color-mix(in srgb, black 45%, transparent), 0 0 0 1px var(--sep-strong); }
.neural-hover b { display: block; font-size: 13px; } .neural-hover span { color: var(--text-3); font-size: 11px; } .neural-hover p { margin: 4px 0 0; color: var(--text-2); }

.neural-legend { margin: 0; font-size: 12px; color: var(--text-3); }
.neural-legend b { font-weight: 600; } .neural-legend .is-read { color: var(--teal); } .neural-legend .is-write { color: var(--orange); }
.neural-legend .is-call { color: var(--accent-text); } .neural-legend .is-outbound { color: var(--yellow); } .neural-legend .is-fail { color: var(--red); }

@media (max-width: 900px) {
  /* stacked, the map and the NOW list need more than the fixed-height screen has: let the page grow */
  .neural-screen { height: auto; }
  .neural-body { flex: none; grid-template-columns: 1fr; grid-template-rows: minmax(360px, 1fr) 220px; }
  .neural-inspector { right: 0; left: 0; top: auto; width: auto; max-height: 70%; }
}

.neural-banner.is-replay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--accent-text);
  background: var(--accent-fill); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.neural-banner.is-replay input[type="range"] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.neural-replay-pick { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: 7px; background: var(--fill-2); font-size: 12px; }
.neural-replay-pick select { border: 0; background: none; color: var(--text); font: 600 12px var(--font); }

.neural-stage { position: relative; min-height: 0; display: flex; }
.neural-stage > .neural-host { flex: 1; }
.neural-host:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.neural-mini { position: absolute; left: 10px; bottom: 10px; width: 180px; height: 120px; border-radius: 10px; cursor: pointer;
  background: color-mix(in srgb, var(--bg) 82%, transparent); box-shadow: 0 0 0 1px var(--sep-strong); }
.neural-sheet { position: fixed; top: 50%; left: 50%; z-index: 60; transform: translate(-50%, -50%); width: min(420px, 92vw); padding: 16px 18px; border-radius: 14px;
  background: var(--surface); box-shadow: 0 24px 60px color-mix(in srgb, black 50%, transparent), 0 0 0 1px var(--sep-strong); }
.neural-sheet h3 { margin: 0 0 10px; font-size: 15px; }
.neural-sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 13px; }
.neural-sheet dd { margin: 0; color: var(--text-2); }
