/* The Hub (PROMPT_HUB_BRAIN §2): HUD, not dashboard tiles. 1px lines, corner brackets,
   wide-tracked monospace labels, a giant thin number. Colours only from styles.css :root. */

:root {
  --hud-line: color-mix(in srgb, var(--accent) 38%, transparent);
  --hud-line-soft: color-mix(in srgb, var(--indigo) 30%, transparent);
  --hud-label: color-mix(in srgb, var(--accent-text) 70%, var(--text-3));
  --hud-track: .22em;
}

/* the canvas root sits behind #app; the Hub's stage lets pointer events through to it */
#neural-root { position: fixed; left: 0; top: 0; z-index: 0; display: none; pointer-events: auto; }
#neural-root canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#app { position: relative; z-index: 1; }
.rb-shell.is-hub { background: radial-gradient(ellipse at 50% 42%, transparent 35%, color-mix(in srgb, black 55%, transparent) 100%); }
.rb-shell.is-hub .rb-main, .rb-shell.is-hub .rb-content { background: transparent; }
.rb-shell.is-hub .rb-content { padding: 0; overflow: hidden; }
/* hit-testing falls through every layer above the stage to the canvas; the chrome stays clickable */
#app:has(.rb-shell.is-hub), .rb-shell.is-hub, .rb-shell.is-hub .rb-main, .rb-shell.is-hub .rb-content { pointer-events: none; }
.rb-shell.is-hub .rb-rail, .rb-shell.is-hub .rb-head, .rb-shell.is-hub .rb-status, .rb-shell.is-hub .rb-dock, .rb-shell.is-hub .rb-spacenav { pointer-events: auto; }
.rb-shell.is-hub .rb-content > * { pointer-events: none; }

.hub { position: relative; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; font-family: var(--mono); color: var(--text); }
.hub:not(.is-core) { overflow: auto; pointer-events: auto; background: var(--bg); }
.hub > *, .hud-stage > .hud-callouts > *, .hud-tip { pointer-events: auto; }
.hub > .hud-stage { pointer-events: none; }

/* top: centred tab bar + chips */
.hud-top { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 16px 0; }
.hud-tabs { display: flex; align-items: center; gap: 10px; }
.hud-tab { padding: 4px 2px 6px; border: 0; background: none; color: var(--text-3); font: 500 11px var(--mono); letter-spacing: var(--hud-track); text-transform: uppercase; cursor: pointer; border-bottom: 1px solid transparent; }
.hud-tab:hover { color: var(--text-2); }
.hud-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.hud-dot { color: var(--text-3); font-size: 10px; }
.hud-chips { display: flex; gap: 8px; }
.hud-chip { padding: 2px 6px; border: 0; background: none; color: var(--hud-label); font: 500 10px var(--mono); letter-spacing: .16em; cursor: pointer; }
.hud-chip.is-quiet { color: var(--text-3); cursor: default; }
.hud-chip:hover:not(.is-quiet), .hud-chip[aria-pressed="true"] { color: var(--text); }

/* the stage: the core slot fills it; callouts float left and right */
.hud-stage { position: relative; min-height: 280px; }
.hud-core-slot { position: absolute; inset: 0; }
.hud-leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hud-leaders polyline { fill: none; stroke: var(--hud-line); stroke-width: 1; }
.hud-leaders polyline.is-back { stroke: var(--hud-line-soft); stroke-dasharray: 2 3; }
.hud-leaders circle { fill: var(--accent-text); }
.hud-callouts { position: absolute; inset: 0; pointer-events: none; }
.hud-callout { position: absolute; display: flex; flex-direction: column; gap: 3px; width: 200px; padding: 9px 11px; border: 0; text-align: left; cursor: pointer; color: var(--text);
  background: color-mix(in srgb, var(--bg) 72%, transparent); box-shadow: inset 0 0 0 1px var(--hud-line-soft);
  --b: color-mix(in srgb, var(--accent-text) 80%, transparent);
  background-image: linear-gradient(var(--b), var(--b)), linear-gradient(var(--b), var(--b)), linear-gradient(var(--b), var(--b)), linear-gradient(var(--b), var(--b)),
    linear-gradient(var(--b), var(--b)), linear-gradient(var(--b), var(--b)), linear-gradient(var(--b), var(--b)), linear-gradient(var(--b), var(--b));
  background-repeat: no-repeat;
  background-size: 8px 1px, 1px 8px, 8px 1px, 1px 8px, 8px 1px, 1px 8px, 8px 1px, 1px 8px;
  background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
  transition: box-shadow .15s ease, transform .1s ease; }
.hud-callout:hover { box-shadow: inset 0 0 0 1px var(--hud-line); }
.hud-callout:active { transform: scale(.98); }
.hud-callout.is-green { --b: color-mix(in srgb, var(--green) 80%, transparent); }
.hud-side-l { left: 4%; } .hud-side-r { right: 4%; }
.hud-slot-0 { top: 8%; } .hud-slot-1 { top: 40%; } .hud-slot-2 { top: 72%; }
.hud-callout-title { font-size: 9.5px; letter-spacing: var(--hud-track); text-transform: uppercase; color: var(--hud-label); }
.hud-callout-line { font: 500 13px var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.hud-callout-sub { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-tip { position: absolute; left: 0; top: 0; z-index: 3; display: flex; flex-direction: column; gap: 3px; max-width: 260px; padding: 8px 10px; font-size: 11px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); box-shadow: inset 0 0 0 1px var(--hud-line); }
.hud-tip[hidden] { display: none; }
.hud-tip b { font: 600 12.5px var(--font-display); }
.hud-tip span { color: var(--text-2); }
.hud-tip-actions { display: flex; gap: 6px; margin-top: 4px; }

/* below the sphere: directive, giant number, progress, stats, ticker */
.hud-directive { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 16px 14px; text-align: center; }
.hud-label { font-size: 10px; letter-spacing: var(--hud-track); text-transform: uppercase; color: var(--hud-label); }
.hud-link { border: 0; background: none; padding: 0; color: var(--text-2); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; border-bottom: 1px dotted var(--hud-line); }
.hud-big { display: flex; align-items: baseline; gap: 12px; }
.hud-big span { font: 200 clamp(40px, 6vw, 68px)/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hud-big small { font-size: 10px; letter-spacing: var(--hud-track); text-transform: uppercase; color: var(--text-3); }
.hud-progress { width: min(360px, 70vw); height: 1px; background: var(--sep-strong); }
.hud-progress span { display: block; height: 1px; background: var(--accent-text); box-shadow: 0 0 8px var(--accent); }
.hud-goal { font-size: 10px; color: var(--text-3); letter-spacing: .06em; }
.hud-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hud-stats b { font-weight: 500; color: var(--text-3); letter-spacing: var(--hud-track); text-transform: uppercase; font-size: 9.5px; margin-right: 4px; }
.hud-ticker { max-width: min(720px, 90vw); font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-ticker b { color: var(--accent-text); font-weight: 500; letter-spacing: .14em; margin-right: 6px; font-size: 9.5px; }

/* process stream */
.hud-stream { position: absolute; right: 12px; top: 64px; bottom: 90px; z-index: 4; width: min(360px, calc(100% - 24px)); display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--bg) 90%, transparent); box-shadow: inset 0 0 0 1px var(--hud-line-soft); font-size: 11px; }
.hud-stream-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 9.5px; letter-spacing: var(--hud-track); text-transform: uppercase; color: var(--hud-label); box-shadow: inset 0 -1px 0 var(--hud-line-soft); }
.hud-stream-head span { flex: 1; }
.hud-stream-tools { display: flex; gap: 6px; padding: 8px 10px; }
.hud-input { flex: 1; min-width: 0; height: 26px; padding: 0 8px; border: 0; background: var(--fill); color: var(--text); font: 11px var(--mono); box-shadow: inset 0 0 0 1px var(--hud-line-soft); }
.hud-mini { padding: 2px 7px; border: 0; background: none; color: var(--accent-text); font: 500 9.5px var(--mono); letter-spacing: .16em; cursor: pointer; box-shadow: inset 0 0 0 1px var(--hud-line-soft); }
.hud-mini:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--hud-line); }
.hud-stream-list { list-style: none; margin: 0; padding: 0 0 8px; overflow: auto; flex: 1; }
.hud-stream-list li { display: grid; grid-template-columns: 58px 74px minmax(0, 1fr); gap: 6px; padding: 3px 10px; color: var(--text-2); }
.hud-stream-list li[data-hub-focus] { cursor: pointer; }
.hud-stream-list li:hover { background: var(--fill); }
.hud-stream-list li time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.hud-stream-list li b { color: var(--hud-label); font-weight: 500; font-size: 9.5px; letter-spacing: .1em; }
.hud-stream-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-stream-list li.is-warn b, .hud-stream-list li.is-warn span { color: var(--orange); }
.hud-stream-list li.is-error b, .hud-stream-list li.is-error span { color: var(--red); }
.hud-stream-list li.is-empty { display: block; color: var(--text-3); }

/* home switch in the breadcrumb */
.rb-switch { display: inline-flex; margin-left: 6px; padding: 2px; border-radius: 8px; background: var(--fill); }
.rb-switch button { height: 24px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text-3); font: 600 12px var(--font); cursor: pointer; }
.rb-switch button[aria-current="page"] { background: var(--fill-3); color: var(--text); }

@media (max-width: 900px) {
  .hud-callout { width: 170px; }
  .hud-side-l { left: 2%; } .hud-side-r { right: 2%; }
}
/* phones: sphere on top, callouts become a swipeable strip */
@media (max-width: 767px) {
  /* a short screen squeezed the stage row below the stage's own height, so the callout strip lay over the directive */
  .hub { grid-template-rows: auto minmax(min-content, 1fr) auto auto; }
  .hud-stage { min-height: 300px; }
  .hud-callouts { position: absolute; inset: auto 0 0 0; display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 8px; scroll-snap-type: x mandatory; pointer-events: auto; }
  .hud-callout { position: static; flex: none; width: 70vw; scroll-snap-align: start; }
  .hud-leaders { display: none; }
  .hud-stream { top: 56px; bottom: 120px; }
}

/* ── talk (§4): the bar, the floating transcript, the TALK tab ─────────── */
.hud-talk { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 16px 12px; }
.hud-transcript { width: min(760px, 100%); max-height: 22vh; overflow: auto; padding: 4px 8px; mask-image: linear-gradient(transparent, black 40%); -webkit-mask-image: linear-gradient(transparent, black 40%); font-family: var(--font); }
.hud-transcript > *:not(:nth-last-child(-n+4)), .hud-transcript .chat-empty { display: none; }  /* always present so chat.js can patch into it; the empty-state intro belongs to the chat screen */
.hud-composer { width: min(760px, 100%); background: color-mix(in srgb, var(--bg) 70%, transparent) !important; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px var(--hud-line) !important; border-radius: 2px !important; }
.hud-talk-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; font-size: 10px; color: var(--text-3); letter-spacing: .08em; }
.hud-talk-meta .hud-mini[aria-pressed="true"] { color: var(--green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 50%, transparent); }
.hud-talk-status { color: var(--text-2); }
.hud-panel { display: grid; min-height: 0; padding: 12px 16px 16px; gap: 12px; font-family: var(--mono); }
.hud-talk-page { grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); }
.hud-panel-head { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; font-size: 10px; letter-spacing: var(--hud-track); text-transform: uppercase; color: var(--hud-label); box-shadow: inset 0 -1px 0 var(--hud-line-soft); }
.hud-panel-head > span { flex: 1; }
.hud-convs, .hud-conv-main { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.hud-conv-list, .hud-results { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.hud-conv, .hud-results button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; color: var(--text); cursor: pointer; font: inherit; }
.hud-conv b, .hud-results b { font: 500 13px var(--font); }
.hud-conv span, .hud-results span { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-results time { font-size: 10px; color: var(--text-3); }
.hud-conv:hover, .hud-results button:hover { background: var(--fill); }
.hud-conv.is-on { box-shadow: inset 2px 0 0 var(--accent); background: var(--fill); }
.hud-talk-log { flex: 1; min-height: 240px; overflow: auto; font-family: var(--font); }
.hud-empty { color: var(--text-3); font-size: 12px; padding: 12px; }
@media (max-width: 767px) {
  .hud-talk-page { grid-template-columns: minmax(0, 1fr); }
  .hud-talk { position: sticky; bottom: 0; padding-top: 8px; background: var(--bg); box-shadow: 0 -1px 0 var(--sep); }  /* opaque: the page scrolls under it */
  .hud-transcript { max-height: 16vh; }
}

/* ── MEMORY · SQUAD · FUNNEL · briefing ─────────────────────────────────── */
.hud-muted { color: var(--text-3); }
.hud-warn { color: var(--orange); font-size: 12px; }
.hud-mini.is-danger { color: var(--red); }
.hud-mini[aria-pressed="true"] { color: var(--text); box-shadow: inset 0 0 0 1px var(--hud-line); }
.hud-memory { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); overflow: auto; }
.hud-mem-main, .hud-mem-side, .squad-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hud-teach { display: flex; gap: 6px; }
.hud-teach .hud-input:first-child { flex: 1; }
.hud-facts, .hud-mini-list, .squad-ideas, .squad-transcript { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hud-fact { padding: 10px 12px; box-shadow: inset 0 0 0 1px var(--hud-line-soft); }
.hud-fact.is-pinned { box-shadow: inset 2px 0 0 var(--accent), inset 0 0 0 1px var(--hud-line-soft); }
.hud-fact-text { font: 14px var(--font); color: var(--text); }
.hud-fact-meta { margin-top: 4px; font-size: 10.5px; color: var(--text-3); }
.hud-fact-meta b { color: var(--accent-text); font-weight: 500; }
.hud-fact-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hud-mini-list li { font-size: 11.5px; color: var(--text-2); }
.hud-mini-list li time { color: var(--text-3); margin-right: 4px; }
.hud-mini-list li.is-rec { color: var(--text); }
.hud-squad { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); overflow: auto; }
.squad-room { min-width: 0; }
.squad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.squad-card { display: flex; gap: 10px; padding: 10px; border: 0; background: color-mix(in srgb, var(--bg) 60%, transparent); text-align: left; color: var(--text); cursor: pointer; font: inherit;
  box-shadow: inset 0 0 0 1px var(--hud-line-soft); transition: box-shadow .15s ease, transform .1s ease; }
.squad-card:hover { box-shadow: inset 0 0 0 1px var(--hud-line); }
.squad-card:active { transform: scale(.98); }
.squad-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 11px; }
.squad-card-body b { font: 600 13px var(--font); }
.squad-card-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.squad-avatar { flex: none; }
.squad-avatar path { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.squad-meeting { padding: 10px; box-shadow: inset 0 0 0 1px var(--hud-line-soft); }
.squad-transcript li b { font: 600 12px var(--font); color: var(--accent-text); }
.squad-transcript li p, .squad-summary, .squad-idea p { margin: 2px 0 0; font: 13px/1.45 var(--font); color: var(--text-2); }
.squad-idea { padding: 10px 12px; box-shadow: inset 0 0 0 1px var(--hud-line-soft); }
.squad-idea > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.squad-idea b { font: 600 13.5px var(--font); }
.squad-idea span { font-size: 11px; }
.squad-idea.is-shipped, .squad-idea.is-measured { box-shadow: inset 2px 0 0 var(--green), inset 0 0 0 1px var(--hud-line-soft); }
.squad-idea.is-rejected { opacity: .55; }
.hud-funnel { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); overflow: auto; }
.funnel { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.funnel-step { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px 60px 110px; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.funnel-step b { color: var(--text); font: 300 20px var(--font-display); text-align: right; }
.funnel-bar { height: 8px; background: var(--fill); }
.funnel-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-strong), var(--teal)); }
.funnel-step.is-bottleneck { color: var(--orange); }
.funnel-step.is-bottleneck .funnel-bar span { background: var(--orange); }
.funnel-rate, .funnel-value { text-align: right; color: var(--text-3); }
.funnel-why { margin-top: 14px; font: 13px/1.5 var(--font); color: var(--text-2); }
.funnel-why b { font: 500 10px var(--mono); letter-spacing: .16em; color: var(--accent-text); }
.hud-table { margin-top: 10px; font-family: var(--font); }
.hud-table th { background: transparent; }
.hud-briefing { position: absolute; left: 4%; bottom: 8px; z-index: 3; width: min(360px, 40%); padding: 10px 12px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  box-shadow: inset 0 0 0 1px var(--hud-line); pointer-events: auto; }
@media (max-width: 1100px) {
  .hud-memory, .hud-squad, .hud-funnel { grid-template-columns: minmax(0, 1fr); }
  .funnel-step { grid-template-columns: 110px minmax(0, 1fr) 56px 52px; }
  .funnel-value { display: none; }
  .hud-briefing { position: static; width: auto; margin: 0 12px; }
}

/* conversation search: compact, never stretched by the column flex */
.hud-convs .hud-search { flex: 0 0 auto; width: 100%; height: 22px; padding: 0 8px; font-size: 10.5px; box-sizing: border-box; }
