:root {
  /* Shared legacy/HQ tokens — final effective values, retained for those surfaces. */
  color-scheme: dark;
  --bg: #060812;
  --surface: rgba(14, 18, 34, .82);
  --surface-raised: rgba(22, 27, 48, .92);
  --surface-soft: rgba(29, 35, 61, .76);
  --border: rgba(132, 145, 205, .18);
  --border-strong: rgba(142, 157, 225, .34);
  --text: #f6f7ff;
  --muted: #b1b7d2;
  --faint: #78809f;
  --teal: #49e5a9;
  --teal-deep: #1e625a;
  --amber: #ffb562;
  --amber-deep: #624c2e;
  --red: #ff777f;
  --red-deep: #633835;
  --blue: #7ea8ff;
  --violet: #9c79ff;
  --cyan: #6de8ff;
  --shadow: 0 24px 80px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.025);
  --radius: 18px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  /* Mission-first studio surfaces, state accents and neutral hierarchy. */
  --studio-bg:          #0a0d14;
  --studio-surface:     #11151e;
  --studio-surface-soft:#161b26;
  --studio-line:        #232a38;
  --studio-line-soft:   #1a202c;
  --studio-text:        #eef1f7;
  --studio-muted:       #9aa3b3;
  --studio-faint:       #a7afbf;
  --studio-violet:      #8f7cf5;
  --studio-green:       #6fc79b;
  --studio-amber:       #d8ac63;
  --studio-red:         #d98282;

  /* spacing rhythm (6 steps) */
  --sp-1: 5px; --sp-2: 9px; --sp-3: 13px; --sp-4: 20px; --sp-5: 30px; --sp-6: 42px;
  /* type scale (6 steps, consistent) */
  --fs-kicker: 10px; --fs-meta: 11px; --fs-body: 13px;
  --fs-lead: 14px;   --fs-title: 17px; --fs-display: 21px;
  --studio-radius: 13px; --studio-radius-sm: 9px;
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--teal);
  color: #0b2220;
  border-radius: 4px;
  font-weight: 700;
}

.skip-link:focus { top: 16px; }

.app-shell { min-height: 100vh; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 76px;
  padding: 16px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--border);
  background: rgba(16, 22, 21, .96);
}

.brand-lockup, .topbar-actions, .connection-state, .mode-chip, .section-heading-meta, .panel-heading, .dialog-header, .task-meta, .status-row, .replay-controls, .app-footer {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 11px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--teal);
  border-radius: 50%;
  color: var(--teal);
  font-family: Georgia, serif;
  font-size: 20px;
}
.brand-name { margin: 0; font-size: 13px; font-weight: 760; letter-spacing: .11em; text-transform: uppercase; }
.brand-subtitle { margin: 1px 0 0; color: var(--faint); font-size: 11px; letter-spacing: .03em; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.mode-chip, .connection-state, .read-only-label, .panel-count, .status-badge, .lane-count {
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.mode-chip, .connection-state { gap: 7px; padding: 5px 9px; color: var(--muted); font-size: 11px; }
.mode-dot, .connection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.mode-dot { box-shadow: 0 0 0 3px rgba(98, 208, 191, .12); }
.connection-state.state-disconnected { color: var(--red); border-color: rgba(238, 141, 131, .45); }
.connection-state.state-disconnected .connection-dot { background: var(--red); }
.connection-state.state-connecting { color: var(--amber); border-color: rgba(232, 179, 107, .45); }
.connection-state.state-connecting .connection-dot { background: var(--amber); }

.button, .icon-button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  border-radius: 5px;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.button { padding: 6px 10px; font-size: 12px; }
.button:hover, .icon-button:hover { border-color: var(--teal); background: rgba(98, 208, 191, .08); color: var(--teal); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-quiet { color: var(--muted); }
.button-small { padding: 4px 8px; font-size: 11px; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; font-size: 24px; line-height: 1; }

.main-content { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 30px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding-bottom: 30px; }
.hero-copy { max-width: 680px; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 10px; font-weight: 780; letter-spacing: .14em; line-height: 1.2; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 13px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 4vw, 52px); font-weight: 400; letter-spacing: -.035em; line-height: 1.03; }
h2 { margin-bottom: 0; font-size: 17px; font-weight: 680; letter-spacing: -.01em; }
h3 { margin-bottom: 4px; font-size: 13px; font-weight: 650; }
.hero-description { max-width: 600px; margin: 0; color: var(--muted); font-size: 15px; }
.overview-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: min(100%, 500px); }
.search-field, .filter-field { position: relative; display: flex; align-items: center; }
.search-field { flex: 1 1 280px; }
.search-field input, .filter-field select {
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}
.search-field input { width: 100%; padding: 0 34px 0 34px; }
.search-field input::placeholder { color: var(--faint); }
.search-field input::-webkit-search-cancel-button { filter: grayscale(1) invert(1); }
.search-icon { position: absolute; left: 12px; z-index: 1; color: var(--faint); font-size: 19px; line-height: 1; }
.search-field kbd { position: absolute; right: 9px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 3px; color: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.filter-field select { min-width: 132px; padding: 0 28px 0 10px; }

.overview-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat-card { min-height: 102px; padding: 16px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); }
.stat-label { margin-bottom: 12px; color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.stat-value { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 31px; line-height: 1; }
.stat-detail { margin-top: 8px; color: var(--faint); font-size: 11px; }
.stat-value.tone-teal { color: var(--teal); }
.stat-value.tone-amber { color: var(--amber); }
.stat-value.tone-red { color: var(--red); }

.agent-room-section { margin-top: 30px; }
.agent-room-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 10px; }
.agent-card {
  display: block;
  overflow: hidden;
  width: 100%;
  min-height: 178px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
}
.agent-card:hover, .agent-card[aria-pressed="true"] { border-color: var(--teal); background: var(--surface-raised); }
.agent-card[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--teal); }
.agent-card:disabled { cursor: default; opacity: .72; }
.agent-card-header > div { min-width: 0; }
.agent-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.agent-card-name { overflow: hidden; margin-bottom: 2px; font-size: 13px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.agent-card-role { overflow: hidden; color: var(--faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.agent-state { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--muted); font-family: var(--font-mono); font-size: 10px; text-transform: lowercase; }
.agent-state::before { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); content: ""; }
.agent-state-active::before, .agent-state-idle::before { background: var(--teal); }
.agent-state-stale::before, .agent-state-unknown::before { background: var(--amber); }
.agent-state-offline::before, .agent-state-unavailable::before { background: var(--red); }
.agent-card-details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.agent-detail-label { margin-bottom: 2px; color: var(--faint); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.agent-detail-value { overflow: hidden; color: var(--muted); font-family: var(--font-mono); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.agent-task-list { grid-column: 1 / -1; min-height: 30px; }
.agent-task-item { display: block; overflow: hidden; margin-top: 3px; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-task-item::before { margin-right: 6px; color: var(--teal); content: "↳"; }
.agent-task-empty { color: var(--faint); font-size: 11px; }

.health-strip { display: flex; align-items: center; gap: 30px; min-height: 84px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.section-label-block { flex: 0 0 150px; padding-right: 18px; border-right: 1px solid var(--border); }
.section-label-block .eyebrow { margin-bottom: 4px; }
.section-label-block h2 { font-size: 14px; }
.health-items { display: flex; flex: 1; gap: 10px; min-width: 0; overflow-x: auto; }
.health-item { flex: 1 1 150px; min-width: 150px; }
.health-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.health-name { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.health-status { color: var(--faint); font-size: 10px; text-transform: uppercase; }
.health-bar { height: 3px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); }
.health-bar span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.health-item.is-attention .health-bar span { background: var(--amber); }
.health-item.is-error .health-bar span { background: var(--red); }

.section-block { margin-top: 48px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-heading-meta { gap: 9px; color: var(--faint); font-size: 11px; }
.divider-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.board-scroll { overflow-x: auto; padding: 2px 1px 8px; scrollbar-color: var(--border-strong) transparent; }
.board-lanes { display: grid; grid-template-columns: repeat(7, minmax(195px, 1fr)); gap: 9px; min-width: 1410px; }
.lane { min-height: 360px; padding: 11px; border: 1px solid var(--border); border-radius: var(--radius); background: #131b1a; }
.lane-header { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-height: 29px; padding-bottom: 11px; border-bottom: 1px solid var(--border); }
.lane-title { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.lane-count { padding: 2px 6px; color: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.lane-cards { display: flex; flex-direction: column; gap: 7px; max-height: 460px; overflow-y: auto; padding: 10px 4px 4px 0; scrollbar-color: var(--border-strong) transparent; }
.task-card { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); text-align: left; color: var(--text); }
.task-card:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.task-card:focus-visible { border-color: var(--teal); }
.task-card-title { display: -webkit-box; overflow: hidden; margin-bottom: 8px; color: var(--text); font-size: 12px; font-weight: 620; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.task-card-status { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 650; }
.task-card-context { overflow: hidden; margin-bottom: 7px; color: var(--faint); font-family: var(--font-mono); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.task-card-agent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-marker { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--faint); }
.status-marker.status-active, .status-marker.status-verified-done { background: var(--teal); }
.status-marker.status-blocked, .status-marker.status-verifying { background: var(--amber); }
.status-marker.status-failed { background: var(--red); }
.empty-state { display: grid; min-height: 120px; place-items: center; padding: 20px; border: 1px dashed var(--border); border-radius: 6px; color: var(--faint); font-size: 12px; text-align: center; }
.lane .empty-state { min-height: 75px; }

.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel-heading { justify-content: space-between; gap: 12px; min-height: 72px; padding: 16px 17px; border-bottom: 1px solid var(--border); }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel-count, .read-only-label { padding: 3px 7px; color: var(--faint); font-size: 10px; }
.read-only-label { border-color: var(--amber-deep); color: var(--amber); }
.panel-note { margin: 0; padding: 12px 17px 16px; color: var(--faint); font-size: 11px; }
.feed-list { min-height: 280px; max-height: 420px; overflow: auto; }
.feed-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 13px 17px; border-bottom: 1px solid rgba(45, 59, 56, .62); }
.feed-item:last-child { border-bottom: 0; }
.feed-marker { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--teal); }
.feed-marker.tone-amber { background: var(--amber); }
.feed-marker.tone-red { background: var(--red); }
.feed-summary { margin-bottom: 3px; color: var(--text); font-size: 12px; line-height: 1.4; }
.feed-detail, .feed-time { color: var(--faint); font-size: 10px; }
.feed-time { white-space: nowrap; }
.feed-link { padding: 0; border: 0; background: transparent; color: var(--teal); text-align: left; }
.feed-link:hover { text-decoration: underline; }

.graph-wrap { min-height: 280px; padding: 16px; overflow: auto; }
.graph-svg { display: block; width: 100%; min-width: 480px; height: 260px; }
.graph-edge { stroke: var(--border-strong); stroke-width: 1.4; }
.graph-edge.graph-edge-handoff { stroke: var(--teal); stroke-dasharray: 4 4; }
.graph-node { outline: none; }
.graph-node rect { fill: var(--surface-raised); stroke: var(--border-strong); stroke-width: 1; }
.graph-node.is-selectable { cursor: pointer; }
.graph-node.is-selectable:hover rect, .graph-node.is-selectable:focus rect { stroke: var(--teal); }
.graph-node text { fill: var(--text); font-family: var(--font-sans); font-size: 11px; }
.graph-node .graph-node-detail { fill: var(--faint); font-size: 9px; }
.graph-legend { display: flex; gap: 16px; padding: 0 17px 15px; color: var(--faint); font-size: 10px; }
.legend-line { display: inline-block; width: 24px; margin: 0 5px 3px 0; border-top: 1px solid var(--border-strong); }
.legend-line.dashed { border-top-style: dashed; border-top-color: var(--teal); }

.metrics-panel, .approvals-panel, .audit-panel { min-height: 280px; }
.metric-list, .approval-list, .audit-list { padding: 4px 17px 12px; }
.metric-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, auto); align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(45, 59, 56, .62); }
.metric-row:last-child, .approval-item:last-child, .audit-item:last-child { border-bottom: 0; }
.metric-name { min-width: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.metric-coverage { min-width: 0; color: var(--faint); font-size: 10px; overflow-wrap: anywhere; }
.metric-value { min-width: 0; color: var(--text); font-family: var(--font-mono); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.metric-value.unknown { color: var(--faint); font-family: var(--font-sans); font-style: italic; }
.approval-item { padding: 13px 0; border-bottom: 1px solid rgba(45, 59, 56, .62); }
.approval-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.approval-title { color: var(--text); font-size: 12px; font-weight: 600; }
.approval-state { color: var(--amber); font-family: var(--font-mono); font-size: 10px; }
.approval-reason { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.approval-source { margin-top: 5px; color: var(--faint); font-size: 10px; }
.audit-list { max-height: 245px; overflow: auto; }
.audit-item { padding: 12px 0; border-bottom: 1px solid rgba(45, 59, 56, .62); }
.audit-top { display: flex; justify-content: space-between; gap: 10px; }
.audit-type { color: var(--text); font-size: 11px; font-weight: 650; }
.audit-time { color: var(--faint); font-family: var(--font-mono); font-size: 10px; white-space: nowrap; }
.audit-detail { margin-top: 3px; color: var(--muted); font-size: 11px; }

.app-footer { justify-content: space-between; gap: 18px; margin-top: 48px; padding-top: 15px; border-top: 1px solid var(--border); color: var(--faint); font-size: 10px; }

.task-dialog { width: min(900px, calc(100% - 28px)); max-height: min(880px, calc(100% - 28px)); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.task-dialog::backdrop { background: rgba(7, 11, 10, .78); }
.dialog-shell { max-height: min(880px, calc(100vh - 28px)); overflow: auto; }
.dialog-header { justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { max-width: 720px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 400; }
.dialog-body { padding: 20px 22px 25px; }
.task-meta { flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; color: var(--muted); font-size: 11px; }
.status-badge .status-marker { width: 6px; height: 6px; }
.meta-pair { color: var(--faint); font-size: 11px; }
.meta-pair strong { color: var(--muted); font-weight: 500; }
.dialog-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(220px, .7fr); gap: 22px; }
.detail-section { margin-bottom: 23px; }
.detail-section-title { margin-bottom: 10px; color: var(--teal); font-size: 10px; font-weight: 760; letter-spacing: .13em; text-transform: uppercase; }
.detail-copy { margin: 0; color: var(--muted); font-size: 13px; }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th, .detail-table td { padding: 7px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.detail-table th { width: 38%; color: var(--faint); font-size: 11px; font-weight: 500; }
.detail-table td { color: var(--text); font-family: var(--font-mono); font-size: 11px; word-break: break-word; }
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: 0; }
.checklist { display: grid; gap: 8px; }
.check-item { display: grid; grid-template-columns: 15px minmax(0, 1fr); gap: 8px; align-items: start; color: var(--muted); font-size: 12px; }
.check-icon { color: var(--faint); font-family: var(--font-mono); }
.check-item.is-passed .check-icon { color: var(--teal); }
.check-item.is-failed .check-icon { color: var(--red); }
.check-detail { display: block; margin-top: 2px; color: var(--faint); font-size: 10px; }
.replay-panel { padding: 15px; border: 1px solid var(--border); border-radius: 7px; background: #131b1a; }
.replay-controls { gap: 7px; margin-bottom: 13px; }
.replay-step-count { margin-left: auto; color: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.replay-progress { width: 100%; accent-color: var(--teal); }
.replay-log { min-height: 76px; margin-top: 12px; padding: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-family: var(--font-mono); font-size: 11px; white-space: pre-wrap; word-break: break-word; }
.log-meta { margin-bottom: 6px; color: var(--faint); font-size: 10px; }
.artifact-list { display: grid; gap: 7px; }
.artifact-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.artifact-item:last-child { border-bottom: 0; }
.artifact-name, .artifact-link { color: var(--text); font-size: 12px; }
.artifact-link { text-decoration: none; }
.artifact-link:hover { color: var(--teal); text-decoration: underline; }
.artifact-copy { min-width: 0; }
.artifact-detail { overflow: hidden; margin-top: 3px; color: var(--faint); font-family: var(--font-mono); font-size: 9px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.artifact-status { color: var(--faint); font-size: 10px; }
.artifact-status.is-verified { color: var(--teal); }
.error-banner { margin: 0 0 18px; padding: 10px 12px; border: 1px solid rgba(238, 141, 131, .42); border-radius: 5px; background: rgba(99, 56, 53, .2); color: var(--red); font-size: 12px; }
.inline-note { padding: 15px 17px; color: var(--faint); font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 980px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .overview-controls { width: 100%; justify-content: stretch; }
  .three-column { grid-template-columns: 1fr 1fr; }
  .audit-panel { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .main-content { width: min(100% - 24px, 1500px); padding-top: 36px; }
  .overview-stats { grid-template-columns: repeat(2, 1fr); }
  .health-strip { align-items: flex-start; flex-direction: column; gap: 15px; }
  .section-label-block { flex: 0 0 auto; width: 100%; padding: 0 0 11px; border-right: 0; border-bottom: 1px solid var(--border); }
  .health-items { width: 100%; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .two-column, .three-column { grid-template-columns: 1fr; }
  .audit-panel { grid-column: auto; }
  .dialog-grid { grid-template-columns: 1fr; }
  .dialog-header, .dialog-body { padding-left: 16px; padding-right: 16px; }
  .app-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}


/* Saint HQ ? source-backed crew floor */
.hq-section { margin-top: 30px; }
.hq-heading { margin-bottom: 10px; }
.hq-shell { overflow: hidden; border: 1px solid var(--border-strong); border-radius: 14px; background: #0d1312; box-shadow: var(--shadow); }
.hq-wall { padding: 15px; border-bottom: 1px solid var(--border-strong); background: linear-gradient(180deg, #17211f, #111817); }
.hq-wall-title { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; color: var(--teal); font-family: var(--font-mono); font-size: 10px; font-weight: 750; letter-spacing: .13em; }
.hq-power { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.hq-power.is-live { background: var(--teal); box-shadow: 0 0 0 4px rgba(98,208,191,.1), 0 0 12px rgba(98,208,191,.45); }
.hq-wall-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hq-wall-card { min-width: 0; padding: 10px 11px; border: 1px solid rgba(64,81,77,.72); border-radius: 7px; background: rgba(8,13,12,.64); }
.hq-wall-label, .hq-wall-detail { display: block; overflow: hidden; color: var(--faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.hq-wall-value { display: block; overflow: hidden; margin: 3px 0; color: var(--text); font-family: var(--font-mono); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.hq-room { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 18px; background-color: #101716; background-image: linear-gradient(rgba(98,208,191,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(98,208,191,.035) 1px, transparent 1px); background-size: 26px 26px; }
.hq-room::before { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 15%, rgba(98,208,191,.08), transparent 36%); content: ""; }
.hq-zone { position: relative; z-index: 1; min-width: 0; padding: 10px; border: 1px solid rgba(64,81,77,.68); border-radius: 10px; background: rgba(21,29,28,.9); }
.hq-zone-command, .hq-zone-creative, .hq-zone-intel { grid-column: span 2; }
.hq-zone-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: var(--faint); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.hq-zone-label span:last-child { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; text-transform: none; }
.hq-zone-desks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hq-zone-command .hq-zone-desks { grid-template-columns: minmax(0, 1fr); }
.hq-desk { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; align-items: center; min-width: 0; min-height: 94px; padding: 10px 9px 22px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px 8px 5px 5px; background: linear-gradient(180deg, #1a2422, #141c1b); color: var(--text); text-align: left; box-shadow: inset 0 -7px 0 rgba(0,0,0,.17); }
.hq-desk::after { position: absolute; right: 9px; bottom: 8px; left: 9px; height: 4px; border-radius: 999px; background: var(--border); content: ""; }
.hq-desk:hover, .hq-desk:focus-visible { border-color: var(--teal); background: linear-gradient(180deg, #1e2c29, #16211f); }
.hq-desk-active { border-color: rgba(98,208,191,.5); }
.hq-desk-blocked, .hq-desk-stale { border-color: rgba(232,179,107,.5); }
.hq-desk-offline, .hq-desk-unavailable { opacity: .6; }
.hq-avatar, .agent-profile-avatar { display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; background: #0d1413; color: var(--teal); font-family: var(--font-mono); font-size: 11px; font-weight: 800; }
.hq-avatar { width: 34px; height: 34px; }
.hq-desk-copy { display: block; min-width: 0; }
.hq-agent-name, .hq-agent-role, .hq-agent-task { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-agent-name { font-size: 11px; font-weight: 720; }
.hq-agent-role { margin-top: 1px; color: var(--faint); font-size: 8px; }
.hq-agent-task { margin-top: 6px; color: var(--muted); font-size: 9px; }
.hq-status { position: absolute; right: 8px; bottom: 9px; z-index: 1; color: var(--faint); font-family: var(--font-mono); font-size: 8px; text-transform: uppercase; }
.hq-status-active { color: var(--teal); }
.hq-status-blocked, .hq-status-stale, .hq-status-verifying { color: var(--amber); }
.hq-status-failed, .hq-status-offline, .hq-status-unavailable { color: var(--red); }
.hq-zone-empty { grid-column: 1 / -1; padding: 16px; border: 1px dashed var(--border); border-radius: 6px; color: var(--faint); font-size: 10px; text-align: center; }
.agent-profile-hero { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 24px; }
.agent-profile-avatar { width: 56px; height: 56px; font-size: 16px; }
.agent-profile-copy { min-width: 0; }
.agent-profile-role { margin: 5px 0 0; color: var(--text); font-size: 14px; }
.agent-profile-meta { margin: 4px 0 0; color: var(--faint); font-size: 10px; overflow-wrap: anywhere; }
.agent-detail-tasks { display: grid; gap: 7px; }
.agent-detail-task { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 11px; border: 1px solid var(--border); border-radius: 6px; background: #131b1a; color: var(--text); text-align: left; }
.agent-detail-task:hover { border-color: var(--teal); }
.agent-detail-task-title { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 800px) {
  .hq-wall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hq-room { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hq-zone { grid-column: span 1; }
  .hq-zone-command, .hq-zone-creative, .hq-zone-intel { grid-column: span 2; }
}

@media (max-width: 430px) {
  .agent-room-section { display: none; }
  .hq-section { margin-top: 22px; }
  .hq-shell { border-radius: 11px; }
  .hq-wall { padding: 10px; }
  .hq-wall-grid { gap: 6px; }
  .hq-wall-card { padding: 8px; }
  .hq-wall-detail { display: none; }
  .hq-room { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; background-size: 20px 20px; }
  .hq-zone, .hq-zone-command, .hq-zone-creative, .hq-zone-intel, .hq-zone-build, .hq-zone-ops { grid-column: span 2; padding: 8px; }
  .hq-zone-desks, .hq-zone-command .hq-zone-desks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .hq-desk { grid-template-columns: 28px minmax(0, 1fr); min-height: 82px; padding: 8px 7px 20px; }
  .hq-avatar { width: 28px; height: 28px; font-size: 9px; }
  .hq-agent-role { display: none; }
  .hq-agent-task { font-size: 8px; }
  .hq-status { right: 7px; bottom: 7px; font-size: 7px; }
  .agent-profile-hero { grid-template-columns: 46px minmax(0, 1fr); }
  .agent-profile-avatar { width: 46px; height: 46px; }
}


/* === Muse-style spatial Saint HQ === */
html, body { background: #060812; }
body {
  min-width: 0;
  background:
    radial-gradient(circle at 48% -20%, rgba(87,74,217,.22), transparent 36%),
    radial-gradient(circle at 110% 18%, rgba(43,101,196,.14), transparent 32%),
    linear-gradient(180deg, #070915 0%, #050710 100%);
}
body::before {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; content: "";
  background-image: radial-gradient(circle at 1px 1px, rgba(151,165,221,.12) 1px, transparent 0);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.4), transparent 65%);
}
.app-shell {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 320px;
  min-height: 100vh;
}
.app-rail {
  position: sticky; top: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center;
  height: 100vh; padding: 20px 10px;
  border-right: 1px solid rgba(132,145,205,.16);
  background: rgba(5,7,15,.88); backdrop-filter: blur(24px);
}
.rail-brand {
  display:grid; place-items:center; width:48px; height:48px; margin-bottom:28px;
  border:1px solid rgba(157,121,255,.44); border-radius:15px;
  background: radial-gradient(circle at 50% 25%, rgba(154,121,255,.4), rgba(61,43,128,.18) 55%, rgba(8,10,21,.8));
  color:#c7b6ff; font-size:25px; box-shadow:0 0 28px rgba(126,90,255,.24);
}
.rail-nav { display:flex; flex-direction:column; gap:10px; width:100%; }
.rail-link {
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  min-height:66px; border:1px solid transparent; border-radius:15px; color:#8f97b7;
  text-decoration:none; transition:.2s ease;
}
.rail-link span { font-size:20px; line-height:1; }
.rail-link small { font-size:10px; font-weight:650; }
.rail-link:hover, .rail-link.is-active {
  color:#fff; border-color:rgba(147,113,255,.48);
  background:linear-gradient(180deg, rgba(104,70,229,.25), rgba(52,38,128,.14));
  box-shadow:0 0 24px rgba(111,78,246,.18), inset 0 1px 0 rgba(255,255,255,.06);
}
.rail-foot { margin-top:auto; display:grid; justify-items:center; gap:7px; color:#69718f; }
.rail-live-dot { width:8px; height:8px; border-radius:50%; background:#3ee9a2; box-shadow:0 0 14px rgba(62,233,162,.7); }
.workspace-shell { min-width:0; }
.topbar {
  position: sticky; top:0; z-index:7; min-height:72px; padding:12px 22px;
  border-bottom:1px solid rgba(132,145,205,.15);
  background:rgba(6,8,18,.76); backdrop-filter:blur(24px);
}
.brand-lockup { min-width:190px; }
.brand-mark {
  width:38px; height:38px; border:0; border-radius:12px;
  background:radial-gradient(circle at 50% 30%, #8870ff, #4733bb 55%, #17152f);
  color:#fff; box-shadow:0 0 25px rgba(119,86,255,.3);
}
.brand-name { font-size:13px; letter-spacing:.08em; }
.brand-subtitle { color:#70789a; }
.topbar-search { display:flex; gap:8px; flex:1; max-width:650px; margin:0 auto; }
.search-field input, .filter-field select {
  border-color:rgba(133,146,206,.22); border-radius:12px;
  background:rgba(16,20,37,.9); box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}
.search-field input { min-height:42px; }
.filter-field select { min-height:42px; }
.topbar-actions { min-width:205px; }
.connection-state { padding:7px 10px; border-color:rgba(78,229,169,.22); background:rgba(31,83,66,.15); color:#79efbf; }
.connection-dot { background:#49e5a9; box-shadow:0 0 14px rgba(73,229,169,.7); }
.button { border-radius:10px; background:rgba(18,23,42,.72); }
.main-content { width:min(1520px, calc(100% - 32px)); margin:0 auto; padding:28px 0 42px; }
.mission-hero { align-items:center; padding:10px 4px 18px; }
.mission-hero h1 { margin-bottom:7px; font-family:Georgia,serif; font-size:clamp(34px,4vw,54px); }
.hero-description { color:#8c94b4; }
.hero-live {
  display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end;
  padding:10px 12px; border:1px solid rgba(132,145,205,.18); border-radius:13px;
  background:rgba(14,18,34,.65); color:#8e97b8; font-size:11px;
}
.hero-live strong { color:#dce1f8; font-weight:560; }
.overview-stats { gap:12px; margin-bottom:16px; }
.stat-card {
  position:relative; overflow:hidden; min-height:104px; padding:16px 17px;
  border-color:rgba(132,145,205,.18); border-radius:16px;
  background:linear-gradient(145deg, rgba(25,31,55,.93), rgba(13,17,32,.9));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035), 0 12px 35px rgba(0,0,0,.16);
}
.stat-card::after { position:absolute; width:90px; height:90px; right:-36px; top:-42px; border-radius:50%; background:rgba(117,88,255,.12); filter:blur(4px); content:""; }
.stat-label { color:#8d95b5; margin-bottom:9px; }
.stat-value { font-family:var(--font-sans); font-weight:720; font-size:28px; letter-spacing:-.04em; }
.stat-detail { color:#69718f; }
.section-heading { align-items:center; margin-bottom:12px; }
.section-note { color:#69718f; font-size:11px; }
.hq-section { margin-top:18px; }
.mission-canvas {
  position:relative; overflow:hidden; border:1px solid rgba(134,147,213,.2); border-radius:24px;
  background:
    radial-gradient(circle at 50% 50%, rgba(96,70,226,.2), transparent 25%),
    radial-gradient(circle at 50% 88%, rgba(35,115,166,.14), transparent 32%),
    linear-gradient(180deg, rgba(13,17,34,.96), rgba(7,10,22,.98));
  box-shadow:0 28px 90px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.03);
}
.mission-canvas::after {
  position:absolute; inset:0; pointer-events:none; content:"";
  background:linear-gradient(rgba(129,149,231,.025) 1px, transparent 1px),linear-gradient(90deg, rgba(129,149,231,.025) 1px, transparent 1px);
  background-size:34px 34px;
  mask-image:radial-gradient(circle at 50% 50%, #000, transparent 72%);
}
.hq-wall {
  position:relative; z-index:4; padding:14px 16px 12px; border-bottom:1px solid rgba(132,145,205,.14);
  background:linear-gradient(180deg, rgba(22,27,48,.86), rgba(12,16,31,.58));
}
.hq-wall-title { color:#84efc5; }
.hq-wall-grid { gap:10px; }
.hq-wall-card {
  border-color:rgba(132,145,205,.18); border-radius:12px;
  background:linear-gradient(150deg, rgba(28,34,61,.8), rgba(12,16,31,.72));
}
.hq-wall-value { color:#f5f6ff; font-family:var(--font-sans); font-size:16px; }
.hq-wall-label { color:#7d85a8; }
.hq-room {
  position:relative; display:block; min-height:710px; padding:0;
  background:radial-gradient(ellipse at 50% 75%, rgba(89,66,223,.14), transparent 50%);
}
.hq-room::before {
  position:absolute; left:50%; top:50%; width:530px; height:530px; transform:translate(-50%,-50%);
  border:1px solid rgba(133,107,255,.14); border-radius:50%;
  background:radial-gradient(circle, rgba(77,57,184,.08), rgba(14,18,34,0) 64%); content:"";
  box-shadow:0 0 100px rgba(80,61,207,.09), inset 0 0 70px rgba(83,65,205,.05);
}
.handoff-layer { position:absolute; inset:0; z-index:1; width:100%; height:100%; pointer-events:none; opacity:.82; }
.handoff-line { fill:none; stroke:url(#handoffGlow); stroke-width:2; stroke-linecap:round; filter:drop-shadow(0 0 5px rgba(116,93,255,.45)); stroke-dasharray:5 8; animation:handoffFlow 7s linear infinite; }
@keyframes handoffFlow { to { stroke-dashoffset:-52; } }
.agent-pod {
  position:absolute; z-index:3; width:150px; min-height:164px; padding:10px 10px 12px;
  border:1px solid rgba(133,146,206,.24); border-radius:20px;
  background:linear-gradient(165deg, rgba(28,34,59,.93), rgba(11,14,28,.94));
  box-shadow:0 18px 42px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.045);
  color:var(--text); text-align:center; transform:translate(-50%,-50%); transition:.2s ease;
}
.agent-pod:hover, .agent-pod:focus-visible { border-color:rgba(148,117,255,.76); box-shadow:0 20px 55px rgba(0,0,0,.32), 0 0 32px rgba(105,75,235,.18); transform:translate(-50%,-52%); }
.agent-pod.is-saint { width:182px; min-height:198px; border-color:rgba(145,111,255,.46); background:linear-gradient(165deg, rgba(46,39,95,.94), rgba(13,16,34,.97)); box-shadow:0 24px 70px rgba(0,0,0,.34), 0 0 50px rgba(104,77,236,.2); }
.agent-pod-state { position:absolute; right:10px; top:10px; width:9px; height:9px; border-radius:50%; background:#7a819c; box-shadow:0 0 0 4px rgba(122,129,156,.08); }
.agent-pod-active .agent-pod-state, .agent-pod-idle .agent-pod-state { background:#3ce89e; box-shadow:0 0 14px rgba(60,232,158,.7); }
.agent-pod-blocked .agent-pod-state, .agent-pod-stale .agent-pod-state, .agent-pod-verifying .agent-pod-state { background:#ffae55; box-shadow:0 0 14px rgba(255,174,85,.6); }
.agent-pod-failed .agent-pod-state, .agent-pod-offline .agent-pod-state { background:#ff6f79; }
.agent-portrait {
  --skin1:#efb88f; --skin2:#b46f53; --hair1:#241927; --hair2:#080912; --shirt1:#6559c9; --shirt2:#25234f;
  position:relative; display:block; width:74px; height:82px; margin:0 auto 8px; border-radius:30px 30px 22px 22px;
  background:radial-gradient(circle at 50% 30%, rgba(255,255,255,.09), transparent 34%), linear-gradient(180deg, rgba(40,44,73,.95), rgba(17,20,38,.8));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 10px 22px rgba(0,0,0,.28); overflow:hidden;
}
.agent-portrait::before {
  position:absolute; left:50%; top:19px; width:38px; height:44px; transform:translateX(-50%); border-radius:46% 46% 50% 50%;
  background:radial-gradient(circle at 35% 28%, rgba(255,255,255,.24), transparent 16%), linear-gradient(145deg,var(--skin1),var(--skin2));
  box-shadow:inset -6px -7px 12px rgba(92,43,36,.2),0 0 0 1px rgba(255,255,255,.05); content:""; z-index:2;
}
.agent-portrait::after {
  position:absolute; left:11px; right:11px; bottom:-19px; height:41px; border-radius:50% 50% 12px 12px;
  background:linear-gradient(145deg,var(--shirt1),var(--shirt2)); box-shadow:inset 0 6px 10px rgba(255,255,255,.05); content:""; z-index:1;
}
.avatar-hair {
  position:absolute; z-index:4; left:17px; top:10px; width:42px; height:27px; border-radius:50% 50% 36% 45%;
  background:linear-gradient(145deg,var(--hair1),var(--hair2)); box-shadow:inset 5px 3px 7px rgba(255,255,255,.07),0 3px 8px rgba(0,0,0,.24);
}
.avatar-hair::after { position:absolute; right:-4px; top:14px; width:12px; height:25px; border-radius:45%; background:var(--hair2); content:""; transform:rotate(-8deg); }
.avatar-eye { position:absolute; z-index:5; top:39px; width:5px; height:4px; border-radius:50%; background:#17131c; box-shadow:0 0 0 1px rgba(255,255,255,.16); }
.avatar-eye.left { left:29px; } .avatar-eye.right { right:29px; }
.avatar-mouth { position:absolute; z-index:5; left:50%; top:53px; width:10px; height:4px; transform:translateX(-50%); border-bottom:2px solid rgba(94,43,45,.68); border-radius:50%; }
.avatar-v1 { --skin1:#d99470;--skin2:#8b4e42;--hair1:#171521;--hair2:#05060a;--shirt1:#285f90;--shirt2:#17253e; }
.avatar-v2 { --skin1:#f2c6a5;--skin2:#bd7d65;--hair1:#6941a1;--hair2:#241638;--shirt1:#9b50cc;--shirt2:#3e215e; }
.avatar-v3 { --skin1:#9e664c;--skin2:#57372f;--hair1:#1b1820;--hair2:#08080c;--shirt1:#317c73;--shirt2:#173c3a; }
.avatar-v4 { --skin1:#e8b18b;--skin2:#a76b55;--hair1:#7a4b31;--hair2:#2c1915;--shirt1:#b4576a;--shirt2:#4c2735; }
.avatar-v5 { --skin1:#f0c6ab;--skin2:#ba846d;--hair1:#d5d6df;--hair2:#6e7186;--shirt1:#586bb3;--shirt2:#252e5e; }
.avatar-v6 { --skin1:#754937;--skin2:#40281f;--hair1:#17191f;--hair2:#050608;--shirt1:#6b56ca;--shirt2:#29224f; }
.avatar-v7 { --skin1:#e7ad8b;--skin2:#ad6c58;--hair1:#cf3e9c;--hair2:#4e1c49;--shirt1:#9d5079;--shirt2:#422239; }
.agent-pod-name { display:block; font-size:13px; font-weight:740; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.agent-pod-role { display:block; margin-top:2px; color:#7f88aa; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.agent-pod-task { display:-webkit-box; overflow:hidden; margin-top:8px; color:#c1c6dc; font-size:9px; line-height:1.35; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.agent-pod-status { display:block; margin-top:6px; color:#6f7899; font-family:var(--font-mono); font-size:8px; text-transform:uppercase; }
.workspace-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(320px,.5fr); gap:14px; margin-top:20px; }
.board-panel, .live-panel { min-width:0; padding:15px; border:1px solid rgba(132,145,205,.18); border-radius:19px; background:rgba(12,16,31,.72); box-shadow:var(--shadow); }
.board-panel .section-heading { margin-bottom:10px; }
.board-scroll { max-height:520px; }
.board-lanes { grid-template-columns:repeat(7,minmax(185px,1fr)); min-width:1350px; }
.lane { min-height:330px; border-color:rgba(132,145,205,.14); border-radius:14px; background:rgba(20,24,44,.68); }
.lane-header { border-color:rgba(132,145,205,.14); }
.task-card { border-color:rgba(132,145,205,.16); border-radius:10px; background:rgba(30,35,61,.72); }
.task-card:hover { border-color:rgba(147,116,255,.44); background:rgba(38,44,75,.78); }
.panel { border-color:rgba(132,145,205,.18); border-radius:18px; background:rgba(12,16,31,.74); box-shadow:var(--shadow); }
.panel-heading { border-color:rgba(132,145,205,.14); }
.feed-item { border-color:rgba(132,145,205,.1); }
.feed-marker { box-shadow:0 0 12px rgba(73,229,169,.55); }
.agent-inspector {
  position:sticky; top:0; z-index:6; height:100vh; overflow:auto; padding:16px;
  border-left:1px solid rgba(132,145,205,.16); background:rgba(7,9,18,.84); backdrop-filter:blur(24px);
}
.inspector-empty { display:grid; place-items:center; min-height:280px; margin-top:72px; padding:24px; border:1px dashed rgba(132,145,205,.18); border-radius:18px; color:#78809e; text-align:center; }
.inspector-empty strong { color:#d8ddf3; margin-top:12px; }
.inspector-empty p { max-width:230px; font-size:11px; }
.inspector-orb { display:grid; place-items:center; width:58px; height:58px; border-radius:20px; background:radial-gradient(circle,#7865e8,#2d245e 65%,#17162d); color:#fff; font-size:28px; box-shadow:0 0 35px rgba(126,93,255,.28); }
.inspector-card { margin-top:56px; }
.inspector-profile { display:grid; justify-items:center; padding:20px 12px 18px; border:1px solid rgba(132,145,205,.18); border-radius:18px; background:linear-gradient(160deg,rgba(31,37,66,.84),rgba(12,16,31,.84)); }
.inspector-profile .agent-portrait { width:92px; height:102px; transform:scale(1.06); margin:0 auto 13px; }
.inspector-name { margin:0; font-size:20px; }
.inspector-role { margin:4px 0 0; color:#8790b2; font-size:11px; }
.inspector-state { margin-top:9px; color:#55e6ae; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; }
.inspector-section { margin-top:12px; padding:14px; border:1px solid rgba(132,145,205,.14); border-radius:15px; background:rgba(15,19,35,.7); }
.inspector-section h3 { margin:0 0 10px; color:#858eb0; font-size:9px; letter-spacing:.12em; text-transform:uppercase; }
.inspector-task { padding:10px; border:1px solid rgba(132,145,205,.14); border-radius:10px; background:rgba(29,34,59,.74); }
.inspector-task + .inspector-task { margin-top:7px; }
.inspector-task strong { display:block; font-size:11px; line-height:1.35; }
.inspector-task span { display:block; margin-top:5px; color:#78819f; font-size:9px; }
.inspector-evidence { margin:0; color:#b4bad2; font-family:var(--font-mono); font-size:9px; white-space:pre-wrap; overflow-wrap:anywhere; }
.advanced-ops { margin-top:20px; border:1px solid rgba(132,145,205,.13); border-radius:16px; background:rgba(10,13,26,.56); }
.advanced-ops > summary { padding:14px 16px; color:#818aa8; cursor:pointer; font-size:11px; font-weight:650; }
.advanced-ops[open] > summary { border-bottom:1px solid rgba(132,145,205,.12); }
.advanced-ops > section { margin:20px 16px; }
.agent-room-grid { grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); }
.agent-card { border-color:rgba(132,145,205,.15); border-radius:14px; background:rgba(20,24,44,.72); }
.health-strip { border-color:rgba(132,145,205,.14); border-radius:14px; background:rgba(16,20,37,.72); }
.app-footer { border-color:rgba(132,145,205,.12); }
.task-dialog { border-color:rgba(145,116,255,.34); border-radius:20px; background:#0d1120; box-shadow:0 40px 100px rgba(0,0,0,.55); }
.task-dialog::backdrop { background:rgba(2,3,9,.76); backdrop-filter:blur(10px); }

@media (max-width:1280px) {
  .app-shell { grid-template-columns:76px minmax(0,1fr); }
  .agent-inspector { position:fixed; right:14px; top:82px; width:310px; height:calc(100vh - 96px); border:1px solid rgba(132,145,205,.22); border-radius:20px; box-shadow:0 25px 80px rgba(0,0,0,.5); transform:translateX(calc(100% + 28px)); transition:transform .25s ease; }
  .agent-inspector.has-selection { transform:translateX(0); }
  .workspace-grid { grid-template-columns:1fr; }
  .live-panel { max-height:420px; }
}
@media (max-width:900px) {
  .app-shell { grid-template-columns:1fr; }
  .app-rail { position:fixed; left:0; right:0; top:auto; bottom:0; width:100%; height:68px; flex-direction:row; padding:6px 10px; border-right:0; border-top:1px solid rgba(132,145,205,.18); }
  .rail-brand,.rail-foot { display:none; }
  .rail-nav { flex-direction:row; justify-content:space-around; }
  .rail-link { min-height:54px; min-width:60px; }
  .topbar { padding:10px 14px; }
  .brand-lockup { min-width:auto; }
  .brand-lockup > div { display:none; }
  .topbar-search { max-width:none; }
  .filter-field { display:none; }
  .topbar-actions .button { display:none; }
  .main-content { width:calc(100% - 20px); padding-bottom:90px; }
  .overview-stats { grid-template-columns:repeat(2,1fr); }
  .hq-room { min-height:680px; }
  .agent-pod { width:132px; min-height:150px; }
  .agent-pod.is-saint { width:155px; }
}
@media (max-width:600px) {
  .mission-hero { align-items:flex-start; }
  .hero-live { width:100%; justify-content:flex-start; }
  .overview-stats { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .stat-card { min-height:94px; padding:13px; }
  .stat-value { font-size:24px; }
  .hq-wall-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hq-room { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; min-height:auto; padding:12px; }
  .hq-room::before,.handoff-layer { display:none; }
  .agent-pod,.agent-pod.is-saint { position:relative !important; left:auto !important; top:auto !important; width:auto; min-height:154px; transform:none !important; }
  .agent-pod.is-saint { grid-column:1 / -1; }
  .agent-inspector { left:10px; right:10px; bottom:76px; top:auto; width:auto; height:min(68vh,600px); transform:translateY(calc(100% + 92px)); }
  .agent-inspector.has-selection { transform:translateY(0); }
  .workspace-grid { margin-top:12px; }
}
@media (max-width:430px) {
  .hq-room { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .agent-room-section { display:none; }
  .topbar-search .search-field kbd { display:none; }
}
@media (prefers-reduced-motion:reduce) { .handoff-line { animation:none; } }


/* === Cinematic 3D avatar + virtual room pass === */
.hq-room {
  min-height: 760px;
  background-image:
    linear-gradient(180deg, rgba(5,7,18,.06) 0%, rgba(5,7,18,.02) 42%, rgba(5,7,18,.32) 100%),
    url('/ops/hq-stage-bg.webp');
  background-size: cover;
  background-position: center top;
  perspective: 1200px;
}
.hq-room::before {
  left:50%; top:54%; width:620px; height:350px; transform:translate(-50%,-50%) rotateX(68deg);
  border:1px solid rgba(136,111,255,.22); border-radius:50%;
  background:radial-gradient(ellipse, rgba(112,82,255,.13), rgba(14,18,34,0) 67%);
  box-shadow:0 0 110px rgba(89,68,233,.17), inset 0 0 80px rgba(119,91,255,.08);
}
.agent-pod {
  width:176px; min-height:248px; padding:8px 9px 13px; overflow:visible;
  border-color:transparent; background:transparent; box-shadow:none;
  backdrop-filter:none;
}
.agent-pod::before {
  position:absolute; z-index:-1; left:50%; bottom:36px; width:128px; height:44px;
  transform:translateX(-50%) rotateX(68deg); border:1px solid rgba(143,118,255,.34); border-radius:50%;
  background:radial-gradient(ellipse, rgba(132,97,255,.30) 0%, rgba(57,44,126,.18) 44%, rgba(8,10,23,0) 74%);
  box-shadow:0 0 30px rgba(113,83,255,.22), inset 0 0 18px rgba(118,92,255,.16); content:'';
}
.agent-pod:hover, .agent-pod:focus-visible {
  border-color:transparent; background:transparent; box-shadow:none; transform:translate(-50%,-54%) scale(1.035);
}
.agent-pod.is-saint {
  width:216px; min-height:292px; border-color:transparent; background:transparent; box-shadow:none;
}
.agent-pod.is-saint::before { width:168px; height:54px; bottom:42px; border-color:rgba(159,128,255,.55); box-shadow:0 0 46px rgba(126,91,255,.34), inset 0 0 22px rgba(126,91,255,.18); }
.agent-pod-state { right:20px; top:20px; z-index:8; width:10px; height:10px; border:2px solid rgba(8,10,22,.78); }
.agent-portrait {
  position:relative; display:block; width:118px; height:148px; margin:0 auto -4px; overflow:visible;
  border:0; border-radius:0; background:transparent; box-shadow:none;
}
.agent-pod.is-saint .agent-portrait { width:150px; height:184px; margin-top:-4px; }
.agent-portrait-img {
  position:absolute; z-index:4; inset:0; width:100%; height:100%; object-fit:contain;
  filter:drop-shadow(0 16px 17px rgba(0,0,0,.48)) drop-shadow(0 0 12px rgba(128,107,255,.12));
  transform:translateZ(32px); transform-origin:50% 88%; transition:filter .22s ease, transform .22s ease;
  user-select:none; pointer-events:none;
}
.agent-pod:hover .agent-portrait-img, .agent-pod:focus-visible .agent-portrait-img {
  transform:translateZ(46px) translateY(-4px) scale(1.035);
  filter:drop-shadow(0 20px 20px rgba(0,0,0,.55)) drop-shadow(0 0 22px rgba(143,112,255,.22));
}
.pod-ring {
  position:absolute; z-index:1; left:50%; top:57%; width:112px; height:112px; transform:translate(-50%,-50%);
  border:1px solid rgba(145,122,255,.24); border-radius:50%;
  background:radial-gradient(circle, rgba(111,89,245,.13), rgba(15,20,43,0) 64%);
  box-shadow:0 0 30px rgba(107,83,235,.12), inset 0 0 26px rgba(121,95,255,.05);
}
.agent-pod.is-saint .pod-ring { width:146px; height:146px; border-color:rgba(155,127,255,.38); box-shadow:0 0 42px rgba(119,86,255,.19), inset 0 0 32px rgba(132,98,255,.08); }
.agent-pod-active .pod-ring { animation:podPulse 2.8s ease-in-out infinite; }
@keyframes podPulse { 0%,100%{opacity:.72;transform:translate(-50%,-50%) scale(.96)} 50%{opacity:1;transform:translate(-50%,-50%) scale(1.07)} }
.avatar-shadow {
  position:absolute; z-index:0; left:50%; bottom:4px; width:90px; height:20px; transform:translateX(-50%);
  border-radius:50%; background:rgba(2,3,9,.68); filter:blur(9px);
}
.agent-pod-copy {
  position:relative; z-index:6; display:block; width:100%; padding:8px 10px 9px;
  border:1px solid rgba(137,148,210,.18); border-radius:13px;
  background:linear-gradient(165deg, rgba(26,31,56,.72), rgba(8,11,24,.66));
  box-shadow:0 12px 34px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.045);
  backdrop-filter:blur(13px);
}
.agent-pod.is-saint .agent-pod-copy { border-color:rgba(150,119,255,.30); background:linear-gradient(165deg,rgba(42,36,86,.78),rgba(10,13,29,.72)); }
.agent-pod-name { font-size:14px; text-shadow:0 2px 10px rgba(0,0,0,.65); }
.agent-pod-role { color:#9ca4c7; font-size:9px; }
.agent-pod-task { margin-top:6px; color:#d4d8e9; }
.agent-pod-status { color:#8992b5; }
.inspector-profile .agent-portrait { width:132px; height:164px; margin:0 auto 0; transform:none; }
.inspector-profile .pod-ring { width:122px; height:122px; }
@media (max-width:900px) { .hq-room { min-height:720px; background-position:center top; } }
@media (max-width:600px) {
  .hq-room { background-image:linear-gradient(180deg,rgba(5,7,18,.20),rgba(5,7,18,.52)),url('/ops/hq-stage-bg.webp'); background-attachment:scroll; }
  .agent-pod,.agent-pod.is-saint { min-height:220px; padding-top:4px; }
  .agent-pod.is-saint { min-height:246px; }
  .agent-portrait { width:100px; height:126px; }
  .agent-pod.is-saint .agent-portrait { width:126px; height:154px; }
  .agent-pod::before { bottom:30px; }
}


/* === Focus-first clarity pass === */
.focus-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:2px 0 20px; }
.focus-card { position:relative; display:grid; grid-template-columns:44px minmax(0,1fr); gap:13px; align-items:start; min-height:132px; padding:18px; overflow:hidden; border:1px solid rgba(132,145,205,.18); border-radius:18px; background:linear-gradient(150deg,rgba(26,31,56,.94),rgba(12,16,31,.94)); box-shadow:0 14px 42px rgba(0,0,0,.18),inset 0 1px 0 rgba(255,255,255,.035); }
.focus-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:14px; background:rgba(126,168,255,.12); color:#8cb4ff; font-size:18px; font-weight:800; }
.focus-card-working .focus-icon { background:rgba(73,229,169,.12); color:#58e8b2; }
.focus-card-needs .focus-icon { background:rgba(73,229,169,.10); color:#58e8b2; }
.focus-card-needs.has-action .focus-icon { background:rgba(255,181,98,.14); color:#ffbd72; }
.focus-card-money .focus-icon { background:rgba(156,121,255,.14); color:#b39aff; }
.focus-kicker { display:block; margin-bottom:4px; color:#8790b0; font-size:10px; font-weight:760; letter-spacing:.08em; text-transform:uppercase; }
.focus-value { display:block; color:#f7f8ff; font-size:28px; line-height:1.05; letter-spacing:-.035em; }
.focus-card p { margin:8px 0 0; color:#aeb5cf; font-size:12px; line-height:1.45; }
.focus-card-needs:not(.has-action) { border-color:rgba(73,229,169,.22); }
.focus-card-needs.has-action { border-color:rgba(255,181,98,.42); box-shadow:0 14px 42px rgba(0,0,0,.18),0 0 30px rgba(255,181,98,.07); }
.focus-card-money.has-action { border-color:rgba(255,181,98,.42); }
.overview-stats { display:none !important; }
.hq-wall { padding:10px 14px; }
.hq-simple-banner { display:flex; align-items:center; gap:10px; min-height:34px; color:#8f98b8; font-size:11px; }
.hq-simple-banner strong { color:#edf0ff; font-size:12px; }
.hq-simple-banner > span:not(.hq-power) { padding-left:10px; border-left:1px solid rgba(132,145,205,.16); }
.hq-banner-clear { margin-left:auto; color:#62e8b1 !important; }
.hq-banner-needs { margin-left:auto; color:#ffbc70 !important; font-weight:700; }
.agent-pod { min-height:146px; padding-bottom:12px; }
.agent-pod.is-saint { min-height:176px; }
.agent-pod-role,.agent-pod-status { display:none !important; }
.agent-pod-simple-state { display:inline-flex; align-items:center; gap:5px; margin-top:3px; color:#7f88a8; font-size:9px; font-weight:720; }
.agent-pod-simple-state::before { width:6px; height:6px; border-radius:50%; background:#7a819c; content:""; }
.agent-pod-simple-state.state-working,.agent-pod-simple-state.state-checking { color:#64e9b5; }
.agent-pod-simple-state.state-working::before,.agent-pod-simple-state.state-checking::before { background:#49e5a9; box-shadow:0 0 10px rgba(73,229,169,.6); }
.agent-pod-simple-state.state-needs-you,.agent-pod-simple-state.state-needs-attention { color:#ffbd72; }
.agent-pod-simple-state.state-needs-you::before,.agent-pod-simple-state.state-needs-attention::before { background:#ffb562; }
.agent-pod-task { margin-top:6px; -webkit-line-clamp:1; color:#aeb5ce; }
.app-shell { grid-template-columns:86px minmax(0,1fr) !important; }
.agent-inspector { position:fixed !important; right:16px; top:84px; z-index:20; width:340px; height:calc(100vh - 100px); border:1px solid rgba(132,145,205,.22); border-radius:20px; box-shadow:0 28px 90px rgba(0,0,0,.5); transform:translateX(calc(100% + 34px)); transition:transform .24s ease; }
.agent-inspector.has-selection { transform:translateX(0); }
.inspector-card { position:relative; margin-top:0; }
.inspector-close { position:sticky; top:0; z-index:2; float:right; padding:7px 10px; border:1px solid rgba(132,145,205,.2); border-radius:10px; background:#111629; color:#b7bdd5; font-size:10px; }
.simple-answer { margin:0; color:#d8dced; font-size:12px; line-height:1.5; }
.clear-section { border-color:rgba(73,229,169,.18); }
.clear-section .simple-answer { color:#70e8b8; }
.needs-you-section { border-color:rgba(255,181,98,.34); background:rgba(72,50,27,.18); }
.needs-you-section .simple-answer { color:#ffd09a; }
.advanced-ops { margin-top:22px; }
.advanced-ops > summary { display:flex; align-items:center; gap:10px; padding:15px 18px; }
.advanced-ops > summary strong { color:#d9def4; font-size:12px; }
.advanced-ops > summary span { color:#737c9e; font-size:10px; }
.advanced-ops .workspace-grid { margin:16px; }
.filter-field { display:none !important; }
.topbar-search { max-width:520px; }
@media(max-width:900px){ .focus-summary{grid-template-columns:1fr;} .focus-card{min-height:108px;} .app-shell{grid-template-columns:1fr !important;} }
@media(max-width:600px){ .focus-summary{gap:8px;margin-bottom:14px;} .focus-card{grid-template-columns:38px minmax(0,1fr);padding:14px;min-height:98px;border-radius:15px;} .focus-icon{width:36px;height:36px;border-radius:12px;font-size:15px;} .focus-value{font-size:24px;} .focus-card p{font-size:11px;} .hq-simple-banner{flex-wrap:wrap;} .hq-banner-clear,.hq-banner-needs{margin-left:0;} .agent-inspector{left:10px;right:10px;bottom:76px;top:auto;width:auto;height:min(70vh,620px);} }

/* === P0 ELI5 command-center pass === */
.room-command-center{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:16px;align-items:start;margin-bottom:18px}
.room-conversation{position:relative;min-width:0;overflow:hidden;border:1px solid rgba(139,151,214,.20);border-radius:24px;background:linear-gradient(180deg,rgba(16,20,38,.96),rgba(8,11,24,.96));box-shadow:0 24px 70px rgba(0,0,0,.28)}
.room-conversation::before{position:absolute;inset:0;background:linear-gradient(180deg,rgba(8,10,25,.76),rgba(8,11,24,.95)),url('/ops/hq-stage-bg.webp') center top/cover no-repeat;opacity:.24;content:'';pointer-events:none}
.saint-chat-head,.mission-thread,.handoff-ribbon,.saint-composer{position:relative;z-index:1}
.saint-chat-head{display:flex;align-items:center;gap:11px;min-height:70px;padding:14px 18px;border-bottom:1px solid rgba(139,151,214,.14);background:rgba(8,11,24,.68);backdrop-filter:blur(16px)}
.saint-chat-head>div{display:grid;gap:2px}.saint-chat-head strong{font-size:15px;color:#f5f7ff}.saint-chat-head>div span{font-size:11px;color:#a5adc9}
.saint-orb{display:grid;place-items:center;width:42px;height:42px;border-radius:15px;background:radial-gradient(circle at 35% 30%,#c5b9ff,#7258df 52%,#2a2258);box-shadow:0 0 28px rgba(128,96,255,.34);font-size:21px;color:white}
.saint-live-pill{margin-left:auto;padding:5px 8px;border:1px solid rgba(73,229,169,.24);border-radius:999px;background:rgba(73,229,169,.09);color:#67e9b8;font-size:9px;font-weight:800;letter-spacing:.08em}
.mission-thread{display:flex;flex-direction:column;gap:12px;min-height:330px;max-height:520px;overflow:auto;padding:20px;scrollbar-width:thin}
.chat-bubble{max-width:min(82%,680px);padding:13px 15px;border-radius:18px;box-shadow:0 10px 28px rgba(0,0,0,.16)}
.chat-bubble strong{font-size:11px}.chat-bubble p{margin:6px 0 0;font-size:13px;line-height:1.55}
.saint-bubble{align-self:flex-start;border:1px solid rgba(139,151,214,.18);border-bottom-left-radius:6px;background:rgba(24,29,51,.88);color:#e8ebf8}
.jon-bubble{align-self:flex-end;border:1px solid rgba(141,112,255,.30);border-bottom-right-radius:6px;background:linear-gradient(145deg,rgba(92,70,184,.88),rgba(60,49,125,.92));color:#fff}
.welcome-bubble{max-width:620px}.bubble-title-row{display:flex;align-items:center;gap:8px}.plain-state{padding:3px 7px;border-radius:999px;background:rgba(123,136,187,.12);color:#9ba5ca;font-size:9px;font-weight:750}.plain-working,.plain-delegated{background:rgba(73,229,169,.10);color:#68e8b9}.plain-needs-you,.plain-hit-a-wall{background:rgba(255,181,98,.12);color:#ffc17b}.plain-done{background:rgba(94,205,255,.10);color:#85d9ff}
.explain-more{margin-top:10px}.explain-more>summary{width:max-content;cursor:pointer;color:#9f92ee;font-size:10px;font-weight:700}.explain-more>summary:hover{color:#c1b8ff}.explain-more p,.explain-body p{margin:8px 0 0;color:#9ca5c3;font-size:10px;line-height:1.55}
.handoff-ribbon{display:flex;align-items:center;gap:7px;overflow:auto;min-height:52px;padding:10px 18px;border-top:1px solid rgba(139,151,214,.10);border-bottom:1px solid rgba(139,151,214,.12);background:rgba(8,11,24,.62);scrollbar-width:none}.handoff-empty{color:#707a9d;font-size:10px}.handoff-chip{flex:0 0 auto;padding:7px 10px;border:1px solid rgba(139,151,214,.18);border-radius:999px;background:rgba(27,32,56,.80);color:#dfe3f5;font-size:10px;font-weight:700}.handoff-chip.is-you{border-color:rgba(116,165,255,.22);color:#a9cbff}.handoff-chip.is-saint{border-color:rgba(148,116,255,.34);color:#c4b4ff}.handoff-chip.is-worker{cursor:pointer}.handoff-chip.handoff-active{border-color:rgba(73,229,169,.42);box-shadow:0 0 18px rgba(73,229,169,.10);color:#7cebc0}.handoff-chip.is-result{border-color:rgba(94,205,255,.34);color:#8ddfff}.handoff-arrow{flex:0 0 auto;color:#586180;font-size:11px}
.saint-composer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:14px 16px 12px;background:rgba(8,11,24,.88);backdrop-filter:blur(16px)}
.saint-composer textarea{min-height:48px;max-height:140px;resize:vertical;padding:13px 14px;border:1px solid rgba(142,154,214,.22);border-radius:15px;background:rgba(25,30,53,.86);color:#f4f5fb;font:inherit;font-size:13px;line-height:1.45;outline:none}.saint-composer textarea:focus{border-color:rgba(148,116,255,.62);box-shadow:0 0 0 3px rgba(148,116,255,.10)}.saint-composer textarea:disabled{opacity:.55}
.send-task-button{align-self:stretch;min-width:76px;border:0;border-radius:14px;background:linear-gradient(145deg,#8e74ff,#6653db);color:#fff;font-weight:800;cursor:pointer}.send-task-button:disabled{opacity:.45;cursor:not-allowed}.composer-help{grid-column:1/-1;margin:0;color:#737d9e;font-size:9px;line-height:1.35}
.room-at-a-glance{display:grid;gap:12px}.room-at-a-glance .focus-summary{grid-template-columns:1fr;margin:0}.room-at-a-glance .focus-card{min-height:96px;padding:14px;grid-template-columns:38px minmax(0,1fr);border-radius:16px}.room-at-a-glance .focus-icon{width:36px;height:36px;border-radius:12px}.room-at-a-glance .focus-value{font-size:23px}.room-at-a-glance .focus-card p{margin-top:5px;font-size:10px}
.crew-strip-panel{padding:15px;border:1px solid rgba(139,151,214,.16);border-radius:18px;background:rgba(12,16,31,.78)}.crew-strip-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.crew-strip-heading strong{display:block;color:#ecf0ff;font-size:12px}.crew-strip{display:grid;gap:7px;margin-top:12px}.crew-mini{display:grid;grid-template-columns:34px minmax(0,1fr);gap:9px;align-items:center;width:100%;padding:7px;border:1px solid transparent;border-radius:12px;background:transparent;color:inherit;text-align:left;cursor:pointer}.crew-mini:hover,.crew-mini:focus-visible{border-color:rgba(145,116,255,.25);background:rgba(34,40,69,.58)}.crew-mini-orb{display:grid;place-items:center;width:34px;height:34px;border-radius:12px;background:linear-gradient(145deg,#4a5277,#252b46);color:#dfe4f9;font-size:9px;font-weight:850;box-shadow:inset 0 1px 0 rgba(255,255,255,.08)}.crew-mini-orb.crew-working,.crew-mini-orb.crew-checking{background:linear-gradient(145deg,#2f806e,#244b50)}.crew-mini-orb.crew-needs-you{background:linear-gradient(145deg,#8d6131,#4f3825)}.crew-mini-copy{min-width:0}.crew-mini-copy strong,.crew-mini-copy span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.crew-mini-copy strong{font-size:10px;color:#e4e8f6}.crew-mini-copy span{margin-top:2px;color:#7f89aa;font-size:8px}
.crew-room-details{margin:0 0 18px;border:1px solid rgba(139,151,214,.12);border-radius:16px;background:rgba(10,13,26,.48)}.crew-room-details>summary{padding:13px 16px;cursor:pointer;color:#929bbc;font-size:10px;font-weight:700}.crew-room-details .hq-section{padding:0 14px 14px}.crew-room-details:not([open])+.advanced-ops{margin-top:0}
.topbar-search{display:none}.mission-hero{padding-top:14px;padding-bottom:13px}.mission-hero h1{font-size:clamp(25px,3vw,38px)}.mission-hero .hero-description{max-width:720px}.hero-live{font-size:10px}

@media(max-width:1100px){.room-command-center{grid-template-columns:minmax(0,1fr) 290px}.room-at-a-glance .focus-card{min-height:90px}.chat-bubble{max-width:88%}}
@media(max-width:900px){.room-command-center{grid-template-columns:1fr}.room-at-a-glance{grid-template-columns:1fr}.room-at-a-glance .focus-summary{grid-template-columns:repeat(3,minmax(0,1fr))}.crew-strip{grid-template-columns:repeat(2,minmax(0,1fr))}.mission-thread{max-height:50vh}.crew-room-details{margin-bottom:14px}}
@media (max-width:600px){
  .main-content{width:calc(100% - 16px);padding-bottom:96px}.mission-hero{display:block;padding:8px 2px 10px}.mission-hero .hero-live{display:none}.mission-hero h1{font-size:24px}.mission-hero .hero-description{font-size:11px;line-height:1.5}
  .room-command-center{gap:10px}.room-conversation{border-radius:18px}.saint-chat-head{min-height:58px;padding:10px 12px}.saint-orb{width:36px;height:36px;border-radius:13px}.saint-live-pill{font-size:8px}.mission-thread{min-height:280px;max-height:48vh;padding:13px;gap:9px}.chat-bubble{max-width:92%;padding:11px 12px;border-radius:15px}.chat-bubble p{font-size:12px}.handoff-ribbon{padding:8px 12px;min-height:46px}.handoff-chip{padding:6px 8px;font-size:9px}
  .saint-composer{position:sticky;bottom:0;grid-template-columns:minmax(0,1fr) 66px;padding:10px 11px 9px}.saint-composer textarea{min-height:46px;padding:12px;font-size:12px}.composer-help{font-size:8px}.room-at-a-glance .focus-summary{grid-template-columns:1fr;gap:7px}.room-at-a-glance .focus-card{min-height:78px}.crew-strip{display:flex;overflow:auto;gap:7px}.crew-mini{flex:0 0 175px}
  .app-rail{position:fixed;left:0;right:0;bottom:0;top:auto}.topbar{min-height:54px}.brand-lockup .brand-mark{display:grid}.advanced-ops>summary span{display:none}.crew-room-details>summary{font-size:10px}
}

/* Keep collapsed technical/full-room surfaces out of layout calculations. */
.advanced-ops:not([open]) > :not(summary),.crew-room-details:not([open]) > :not(summary){display:none!important}
.room-command-center>*,.room-at-a-glance,.room-conversation,.focus-summary,.focus-card,.saint-composer{min-width:0;max-width:100%}
.saint-composer textarea{min-width:0;width:100%}
@media(max-width:900px){.room-command-center{grid-template-columns:minmax(0,1fr)}.room-at-a-glance{grid-template-columns:minmax(0,1fr)}}

/* Visible crew strip uses the same friendly soft-3D avatar art as the room. */
.crew-mini-orb{overflow:hidden;padding:0;background:linear-gradient(145deg,rgba(88,74,166,.42),rgba(30,35,67,.9))}
.crew-mini-avatar{display:block;width:100%;height:100%;object-fit:cover;object-position:center 22%;transform:scale(1.18) translateY(2px);filter:drop-shadow(0 5px 7px rgba(0,0,0,.22));pointer-events:none;user-select:none}
.crew-mini-orb.crew-working,.crew-mini-orb.crew-checking{box-shadow:0 0 0 2px rgba(73,229,169,.24),0 0 16px rgba(73,229,169,.15)}
.crew-mini-orb.crew-needs-you{box-shadow:0 0 0 2px rgba(255,181,98,.28),0 0 16px rgba(255,181,98,.14)}

/* === Canonical task accounting receipt === */
.task-coverage-card{display:grid;grid-template-columns:12px minmax(0,1fr);gap:10px;align-items:start;padding:13px 15px;border:1px solid rgba(139,151,214,.15);border-radius:15px;background:rgba(12,16,31,.68)}
.task-coverage-dot{width:9px;height:9px;margin-top:5px;border-radius:50%;background:#8992b5;box-shadow:0 0 0 4px rgba(137,146,181,.08)}
.task-coverage-card strong{display:block;color:#e7eaf8;font-size:11px}.task-coverage-card>div>p{margin:4px 0 0;color:#7f89aa;font-size:9px;line-height:1.45}
.task-coverage-card.is-complete{border-color:rgba(73,229,169,.20)}.task-coverage-card.is-complete .task-coverage-dot{background:#49e5a9;box-shadow:0 0 12px rgba(73,229,169,.55)}
.task-coverage-card.is-incomplete{border-color:rgba(255,181,98,.35)}.task-coverage-card.is-incomplete .task-coverage-dot{background:#ffb562;box-shadow:0 0 12px rgba(255,181,98,.45)}


/* === Final ELI5 polish: progressive detail + story-shaped delegation === */
.focus-explain{margin-top:8px}.focus-explain>summary{font-size:9px;color:#828db1}.focus-explain p{max-width:270px}
.handoff-ribbon{align-items:stretch;gap:8px;min-height:64px}
.handoff-step{display:grid;gap:3px;align-content:center;flex:0 0 auto;min-width:92px;padding:8px 11px;border:1px solid rgba(139,151,214,.18);border-radius:13px;background:rgba(27,32,56,.82);color:#dfe3f5;text-align:left;font:inherit;cursor:default}
button.handoff-step{cursor:pointer}.handoff-step-copy{font-size:10px;font-weight:800;white-space:nowrap}.handoff-step-state{font-size:8px;color:#7f89aa;white-space:nowrap}
.handoff-step.is-you{border-color:rgba(116,165,255,.25);background:rgba(41,54,88,.72)}.handoff-step.is-you .handoff-step-copy{color:#b6d2ff}
.handoff-step.is-saint{border-color:rgba(148,116,255,.36);background:rgba(65,49,119,.50)}.handoff-step.is-saint .handoff-step-copy{color:#d0c5ff}
.handoff-step.is-worker.handoff-active,.handoff-step.is-worker.handoff-running{border-color:rgba(73,229,169,.42);box-shadow:0 0 18px rgba(73,229,169,.10)}.handoff-step.is-worker.handoff-active .handoff-step-state,.handoff-step.is-worker.handoff-running .handoff-step-state{color:#74e8bd}
.handoff-step.is-result{border-color:rgba(94,205,255,.34);background:rgba(34,68,88,.48)}.handoff-step.is-result .handoff-step-copy,.handoff-step.is-result .handoff-step-state{color:#91dfff}
.handoff-arrow{align-self:center;padding:0 1px;color:#657091}
@media(max-width:600px){.handoff-ribbon{min-height:60px}.handoff-step{min-width:84px;padding:7px 9px}.handoff-step-copy{font-size:9px}.handoff-step-state{font-size:7px}.focus-explain p{max-width:none}}

/* Idle crew are people in the room, not mini dashboards. */
.agent-pod.pod-simple-ready .agent-pod-copy,.agent-pod.pod-simple-waiting .agent-pod-copy,.agent-pod.pod-simple-idle .agent-pod-copy{width:max-content;max-width:150px;margin:0 auto;padding:5px 9px 6px;border-color:rgba(137,148,210,.08);background:rgba(10,13,29,.38);box-shadow:none;backdrop-filter:blur(7px)}
.agent-pod.pod-simple-ready .agent-pod-name,.agent-pod.pod-simple-waiting .agent-pod-name,.agent-pod.pod-simple-idle .agent-pod-name{font-size:13px}
.agent-pod.pod-simple-ready .agent-pod-simple-state,.agent-pod.pod-simple-waiting .agent-pod-simple-state,.agent-pod.pod-simple-idle .agent-pod-simple-state{font-size:8px;color:#7f89aa}
.agent-pod.pod-simple-working .agent-pod-copy,.agent-pod.pod-simple-checking .agent-pod-copy,.agent-pod.pod-simple-needs-you .agent-pod-copy{border-color:rgba(137,148,210,.24)}
.agent-pod.pod-simple-working .agent-pod-task,.agent-pod.pod-simple-checking .agent-pod-task,.agent-pod.pod-simple-needs-you .agent-pod-task{display:block;font-size:9px;line-height:1.35;max-height:2.7em;overflow:hidden}
.agent-pod.is-saint .agent-pod-copy{width:100%;max-width:none;margin:0 auto;padding:8px 10px 9px}


/* Living Studio Release 1 */
body { background: var(--studio-bg); color: var(--studio-text); }
.living-studio { min-height: 100vh; background: radial-gradient(circle at 50% -20%, rgba(143,124,245,.10), transparent 32rem), var(--studio-bg); }
.studio-bar { position: sticky; top: 0; z-index: 12; display:flex; align-items:center; justify-content:space-between; gap:18px; min-height:62px; padding:12px clamp(18px,4vw,52px); border-bottom:1px solid var(--studio-line); background:rgba(11,14,22,.94); backdrop-filter:blur(16px); }
.studio-brand,.studio-status,.saint-presence,.mission-heading,.studio-section-heading,.crew-dock-top,.story-assignment-top { display:flex; align-items:center; }
.studio-brand { gap:10px; }
.studio-brand > div { display:grid; }
.studio-brand strong { font-size:13px; letter-spacing:.03em; }
.studio-brand span:last-child { color:var(--studio-muted); font-size:11px; }
.studio-status { gap:10px; color:var(--studio-muted); font-size:12px; }
.studio-main { width:min(1080px,calc(100% - 36px)); margin:0 auto; padding:34px 0 44px; }
.section-kicker { display:block; margin-bottom:5px; color:var(--studio-violet); font-size:10px; font-weight:760; letter-spacing:.13em; text-transform:uppercase; }
.studio-section-heading { justify-content:space-between; gap:18px; margin-bottom:16px; }
.studio-section-heading h1,.studio-section-heading h2,.mission-heading h2 { margin:0; font-family:var(--font-sans); font-weight:690; letter-spacing:-.02em; }
.studio-section-heading h1 { font-size:20px; }
.studio-section-heading h2,.mission-heading h2 { font-size:18px; }
.section-note,#current-mission-meta { margin:4px 0 0; color:var(--studio-muted); font-size:12px; }
.needs-you-band { margin-bottom:22px; padding:16px 18px; border-left:3px solid var(--studio-amber); background:rgba(221,181,111,.055); }
.needs-you-list { display:grid; gap:8px; }
.needs-clear { margin:0; color:var(--studio-muted); }
.needs-item { padding:11px 0 2px; border-top:1px solid rgba(221,181,111,.18); }
.needs-item p { margin:3px 0; color:var(--studio-muted); }
.needs-mission { color:var(--studio-amber); font-size:10px; }
.mission-stage { margin-bottom:26px; padding:0 0 24px; border-bottom:1px solid var(--studio-line); }
.mission-heading { justify-content:space-between; align-items:flex-start; gap:22px; margin-bottom:16px; }
.saint-presence { gap:9px; min-width:190px; justify-content:flex-end; color:var(--studio-muted); }
.saint-presence > div { display:grid; }
.saint-presence strong { color:var(--studio-text); }
.mission-conversation { display:grid; gap:12px; }
.mission-thread { min-height:130px; max-height:360px; overflow:auto; padding:2px 0; }
.chat-bubble { max-width:760px; padding:13px 15px; border:0; border-radius:14px; background:var(--studio-surface); }
.jon-bubble { margin-left:auto; background:#1c2230; }
.saint-bubble { box-shadow:inset 2px 0 0 rgba(143,124,245,.58); }
.saint-composer { position:sticky; bottom:12px; display:grid; grid-template-columns:1fr auto; gap:8px; padding:9px; border:1px solid var(--studio-line); border-radius:14px; background:rgba(18,23,34,.96); box-shadow:0 14px 40px rgba(0,0,0,.26); }
.saint-composer textarea { min-height:42px; resize:vertical; border:0; outline:0; background:transparent; color:var(--studio-text); padding:9px; }
.send-task-button { align-self:end; min-height:38px; padding:0 16px; border:0; border-radius:10px; background:#5947bd; color:#fff; font-weight:700; }
.composer-help { grid-column:1/-1; margin:0 8px 3px; color:var(--studio-muted); font-size:10px; }
.mission-story-panel,.workbench-panel,.crew-dock-panel { margin:0 0 26px; }
.mission-story-body { display:grid; gap:10px; }
.story-assignment { padding:14px 0; border-top:1px solid var(--studio-line); }
.story-assignment-top { justify-content:space-between; gap:12px; margin-bottom:9px; }
.story-assignment-person { color:var(--studio-muted); font-size:11px; }
.story-attempt { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:7px 10px; border-radius:9px; color:var(--studio-muted); background:var(--studio-surface); }
.story-attempt.is-new { animation:studio-enter .32s ease-out; box-shadow:inset 2px 0 0 var(--studio-violet); }
.story-attempt-state { color:var(--studio-text); font-size:11px; }
@keyframes studio-enter { from { opacity:0; transform:translateY(5px); } to { opacity:1; transform:none; } }
.general-workbench-body { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.workbench-item { min-height:116px; padding:13px; border-top:1px solid var(--studio-line); background:linear-gradient(180deg,rgba(255,255,255,.015),transparent); }
.workbench-label { color:var(--studio-muted); font-size:10px; text-transform:uppercase; letter-spacing:.08em; }
.workbench-value { margin:13px 0 0; }
.workbench-list { margin:10px 0 0; padding-left:16px; color:var(--studio-muted); font-size:12px; }
.crew-dock-list { display:flex; gap:10px; overflow-x:auto; padding-bottom:4px; }
.crew-dock-person { flex:0 0 220px; padding:12px 0; border-top:1px solid var(--studio-line); }
.crew-dock-top { justify-content:space-between; gap:12px; }
.crew-presence { color:var(--studio-muted); font-size:10px; }
.presence-present .crew-presence { color:var(--studio-green); }
.crew-activity { min-height:36px; margin:8px 0 4px; color:var(--studio-muted); font-size:12px; }
.crew-availability { font-size:10px; color:var(--studio-muted); }
.studio-empty { margin:0; color:var(--studio-muted); }
.crew-room-details,.advanced-ops { margin:22px 0; border-top:1px solid var(--studio-line); }
.crew-room-details > summary,.advanced-ops > summary { padding:15px 0; color:var(--studio-muted); cursor:pointer; }
.advanced-toolbar { display:flex; gap:10px; margin:4px 0 20px; }
.advanced-toolbar .search-field { flex:1; }
.advanced-toolbar .search-field input { width:100%; }

@media (max-width: 760px) {
  .studio-main { width:min(100% - 24px,1080px); padding-top:22px; }
  .studio-bar { align-items:flex-start; padding:10px 12px; }
  .studio-status { flex-wrap:wrap; justify-content:flex-end; }
  #hq-summary { display:none; }
  .mission-heading { display:grid; }
  .saint-presence { justify-content:flex-start; }
  .general-workbench-body { grid-template-columns:1fr 1fr; }
}
@media (max-width: 600px) {
  .studio-brand span:last-child,.button-quiet { display:none; }
  .studio-main { width:min(100% - 18px,1080px); }
  .needs-you-band { padding:13px 12px; }
  .general-workbench-body { grid-template-columns:1fr; }
  .saint-composer { position:sticky; bottom:8px; grid-template-columns:1fr auto; }
  .section-note { display:none; }
}


/* === Living Studio spatial truth + mobile Release 1 === */
.mobile-studio-nav{display:flex;justify-content:center;gap:12px;padding:8px 16px;background:var(--studio-bg)}
.mobile-studio-nav a,.mobile-studio-nav button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:8px 12px;border:0;border-radius:8px;background:transparent;color:var(--studio-text);font:inherit;text-decoration:none}
.mobile-studio-nav :focus-visible{outline:2px solid var(--studio-violet);outline-offset:2px}
.crew-dock-list{display:flex;gap:10px;overflow-x:auto;overscroll-behavior-inline:contain;scroll-snap-type:x proximity;padding:2px 0 8px;max-width:100%}
.crew-dock-person{flex:0 0 min(280px,78vw);scroll-snap-align:start}
.hq-room.living-room-grid{position:relative!important;left:auto!important;top:auto!important;transform:none!important;width:100%!important;height:auto!important;min-height:0!important;display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:22px!important;border-radius:18px;background:linear-gradient(180deg,rgba(17,21,38,.72),rgba(9,12,24,.9)),url('/ops/hq-stage-bg.webp') center top/cover no-repeat!important}
.room-person.hq-desk{position:relative!important;left:auto!important;top:auto!important;transform:none!important;display:grid;grid-template-columns:58px minmax(0,1fr);align-items:center;gap:10px;min-width:0;min-height:112px;padding:12px;border:1px solid rgba(139,124,205,.16);border-radius:16px;background:rgba(12,16,30,.84);color:inherit;text-align:left;box-shadow:none}
.room-person.is-active-stage{border-color:rgba(139,124,205,.48);box-shadow:0 10px 32px rgba(0,0,0,.22);transform:translateY(-2px)!important}
.room-person.is-quiet{opacity:.84}
.room-avatar{display:grid;place-items:center;width:58px;height:68px;border-radius:14px;background:rgba(119,92,255,.08);overflow:hidden;color:var(--text);font-weight:800}.room-avatar img{width:100%;height:100%;object-fit:contain}.room-person-copy{display:grid;gap:4px;min-width:0}.room-person-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.provider-badge{width:max-content;padding:2px 6px;border:1px solid rgba(139,124,205,.24);border-radius:999px;color:var(--faint);font-size:10px;text-transform:uppercase;letter-spacing:.08em}.room-person-state{font-size:12px;color:var(--muted)}.room-person-state.is-working{color:#d9d3ff}.room-person-activity{overflow:hidden;color:var(--faint);font-size:11px;text-overflow:ellipsis;white-space:nowrap}.room-active-strip{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.room-active-label,.room-stat-label{color:var(--faint);font-size:10px;text-transform:uppercase;letter-spacing:.1em}.room-active-chip{padding:4px 8px;border-radius:999px;background:rgba(119,92,255,.13);font-size:11px}.room-active-empty{color:var(--faint);font-size:12px}.spatial-room-summary{min-width:0}.room-presence-card{display:flex;align-items:baseline;gap:8px;min-width:0}.room-stat-value{font-size:18px}.room-stat-note{color:var(--faint);font-size:11px}
@media(max-width:800px){.hq-room.living-room-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:430px){
  html,body{max-width:100%;overflow-x:clip}.living-studio,.studio-main{max-width:100%;min-width:0;overflow-x:clip}
  .mobile-studio-nav{display:grid;grid-template-columns:repeat(4,1fr);position:sticky;top:0;z-index:34;margin:0 8px 8px;padding:5px;border:1px solid rgba(139,124,205,.15);border-radius:12px;background:rgba(9,12,22,.94);backdrop-filter:blur(16px)}.mobile-studio-nav a,.mobile-studio-nav button{appearance:none;border:0;background:transparent;color:var(--muted);font:inherit;font-size:11px;text-align:center;text-decoration:none;padding:8px 3px}
  .needs-you-band{position:sticky;top:48px;z-index:28;max-height:34vh;overflow:auto;box-shadow:0 10px 30px rgba(0,0,0,.2)}
  .crew-dock-list{overflow-x:auto;max-width:100%;padding-bottom:10px}.crew-dock-person{flex-basis:78vw}
  .crew-room-details[open]{position:fixed;inset:8px;z-index:80;overflow:auto;max-width:none;margin:0;padding:10px;border:1px solid rgba(139,124,205,.28);border-radius:16px;background:#0b0e16;box-shadow:0 24px 80px rgba(0,0,0,.55)}.crew-room-details[open]>summary{position:sticky;top:-10px;z-index:2;margin:-10px -10px 10px;padding:12px;background:#0b0e16}.crew-room-details[open] .hq-section{margin-top:0}.crew-room-details[open] .hq-room.living-room-grid{grid-template-columns:repeat(2,minmax(0,1fr));padding:10px!important;gap:8px}.crew-room-details[open] .room-person.hq-desk{grid-template-columns:42px minmax(0,1fr);min-height:90px;padding:8px}.crew-room-details[open] .room-avatar{width:42px;height:50px}
  .saint-composer{position:relative;z-index:3}.mission-stage,.workbench-panel,.crew-dock-panel,.mission-story-panel{min-width:0;max-width:100%}
}


/* ============================================================================
   Living Studio — visual redesign R1 (coherent control-room layer)
   ----------------------------------------------------------------------------
   Authoritative cascade for the Living Studio shell: source-order supersedes the
   historical passes above (legacy base / HQ / Muse-spatial / focus-first / ELI5 /
   Release 1). Those blocks are retained only because their selectors are bound by
   the test contracts; this layer is the single coherent redesign on top.

   Behavior is untouched: no DOM ids, ARIA, listeners, data contracts, freshness
   semantics or real-activity truth change here. Layout, density, typography only.

   Design intent (control room, not ticket queue):
     · current mission leads; global observed work and crew remain secondary
     · the human-gate list is a compact, bounded, fully-scrollable tray
     · calm premium dark studio: one accent, hairline borders, tight spacing scale,
       no decorative glow or fake busy states.
   ========================================================================== */



html, body { background: var(--studio-bg); }
body {
  color: var(--studio-text);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.living-studio {
  min-height: 100vh;
  background: radial-gradient(56rem 22rem at 50% -16rem, rgba(143,124,245,.09), transparent 72%), var(--studio-bg);
}

/* --- Top bar: quiet hairline, no glow ------------------------------------ */
.studio-bar {
  min-height: 56px;
  padding: 9px clamp(16px, 3.4vw, 38px);
  border-bottom: 1px solid var(--studio-line);
  background: rgba(10,13,20,.94);
  backdrop-filter: blur(12px);
}
.studio-brand strong { font-size: 13px; letter-spacing: .02em; }
.studio-brand span:last-child { color: var(--studio-faint); font-size: var(--fs-meta); }
.studio-status { gap: var(--sp-2); color: var(--studio-muted); font-size: 12px; }
.button { border-color: var(--studio-line); border-radius: var(--studio-radius-sm); color: var(--studio-text); }
.button:hover { border-color: var(--studio-violet); background: rgba(143,124,245,.08); color: #cfc6ff; }

/* --- Mission-first grid; global activity and crew remain secondary -------- */
.studio-main {
  display: grid;
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: var(--sp-4) 0 var(--sp-6);
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-areas:
    "mission mission"
    "needs needs"
    "story story"
    "workbench workbench"
    "compose compose"
    "exec exec"
    "council council"
    "crew crew"
    "room    room"
    "adv     adv"
    "footer  footer";
  gap: var(--sp-4);
  align-items: start;
}
#independent-execution { grid-area: exec; }
#current-mission       { grid-area: mission; }
#crew-dock             { grid-area: crew; }
#council-panel         { grid-area: council; }
#global-needs-you      { grid-area: needs; }
#mission-story         { grid-area: story; }
#general-workbench     { grid-area: workbench; }
.crew-room-details     { grid-area: room; margin: 0; }
#advanced-ops          { grid-area: adv; margin: 0; }
.app-footer            { grid-area: footer; }

/* --- Dominant working surfaces ------------------------------------------- */
.mission-stage,
.mission-story-panel,
.independent-execution-panel,
.workbench-panel,
.crew-dock-panel {
  min-width: 0;
  margin: 0;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  border: 1px solid var(--studio-line-soft);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}
/* Global independent work remains distinct from the primary mission. */
.independent-execution-panel {
  border-color: rgba(143,124,245,.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  background: linear-gradient(180deg, rgba(143,124,245,.045), transparent 220px), var(--studio-surface);
}
/* Crew dock is secondary presence, not a second mission feed. */
.crew-dock-panel { background: linear-gradient(180deg, rgba(143,124,245,.03), transparent 120px), var(--studio-surface); }

/* Consistent headings */
.studio-section-heading { align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.studio-section-heading h1,
.studio-section-heading h2,
.mission-heading h2 { font-size: var(--fs-title); font-weight: 650; letter-spacing: -.01em; }

/* Compact mission/system row — the "control" line */
.mission-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.mission-heading > div { min-width: 0; }
.mission-heading h2 { font-size: var(--fs-display); margin: 0; }
.section-kicker { margin-bottom: 2px; font-size: var(--fs-kicker); font-weight: 720; letter-spacing: .12em; }
.section-note, #current-mission-meta { margin: 2px 0 0; color: var(--studio-faint); font-size: var(--fs-meta); }
.saint-presence { gap: var(--sp-2); min-width: 170px; justify-content: flex-end; color: var(--studio-muted); }
.saint-presence strong { color: var(--studio-text); }
.saint-orb {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: rgba(143,124,245,.14); color: #c9bfff; font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(143,124,245,.28);
}

/* --- Mission conversation + composer: evidence first, then input ---------- */
.mission-thread { min-height: 0; max-height: 220px; overflow: auto; padding: 2px 0; }
.chat-bubble { max-width: 620px; padding: var(--sp-2) var(--sp-3); border-radius: 12px; background: var(--studio-surface-soft); }
.saint-bubble { box-shadow: inset 2px 0 0 rgba(143,124,245,.5); }
.jon-bubble { background: #1a2130; }
.chat-bubble p { margin: 4px 0 0; font-size: var(--fs-body); }
.saint-composer {
  position: static;                     /* a secondary dock, never a hero overlay */
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); align-items: center;
  padding: 6px; border: 1px solid var(--studio-line); border-radius: var(--studio-radius-sm);
  background: rgba(17,21,30,.9);
}
.saint-composer textarea { min-height: 34px; padding: 7px; background: transparent; color: var(--studio-text); font-size: var(--fs-body); }
.send-task-button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: #5b4ac4; color: #fff; font-weight: 700; }
.send-task-button:hover { background: #6a58d6; }
.composer-help { margin: 2px 7px; color: var(--studio-faint); font-size: var(--fs-kicker); }

/* --- Crew dock: dense secondary presence rows ---------------------------- */
.crew-dock-list { display: grid; gap: 0; padding-bottom: 2px; }
.crew-dock-person { padding: var(--sp-2) 0; border-top: 1px solid var(--studio-line-soft); }
.crew-dock-person:first-child { border-top: 0; }
.crew-presence { color: var(--studio-faint); font-size: var(--fs-kicker); text-transform: uppercase; letter-spacing: .06em; }
.presence-present .crew-presence { color: var(--studio-green); }
.crew-activity { min-height: 0; margin: 3px 0 2px; color: var(--studio-muted); font-size: var(--fs-meta); }
.crew-availability { color: var(--studio-faint); font-size: var(--fs-kicker); }

/* --- Human-gate tray: compact, bounded, every gate still reachable -------- */
.needs-you-band {
  margin: 0;
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border: 1px solid var(--studio-line-soft);
  border-left: 3px solid var(--studio-amber);
  border-radius: var(--studio-radius);
  background: linear-gradient(90deg, rgba(216,172,99,.05), rgba(216,172,99,.01) 44%), var(--studio-surface);
}
.needs-you-band .studio-section-heading { margin-bottom: var(--sp-1); }
.needs-you-band .studio-section-heading h1 { font-size: var(--fs-lead); }
.needs-you-list {
  display: grid; gap: 0;
  max-height: 116px;               /* ~3 dense rows — no longer eats the fold */
  overflow-y: auto;                /* every gate stays reachable by scroll */
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--studio-line) transparent;
}
.needs-you-list:focus-visible { outline: 2px solid var(--studio-violet); outline-offset: 2px; }
.needs-you-list::-webkit-scrollbar { width: 8px; }
.needs-you-list::-webkit-scrollbar-thumb { background: var(--studio-line); border-radius: 999px; }
.needs-item { padding: var(--sp-1) 0 var(--sp-1); border-top: 1px solid var(--studio-line-soft); }
.needs-item strong { font-size: 12.5px; color: var(--studio-text); }
.needs-item p { margin: 1px 0 0; color: var(--studio-muted); font-size: var(--fs-meta); }
.needs-mission { color: var(--studio-amber); font-size: var(--fs-kicker); letter-spacing: .04em; }
.needs-clear { margin: 0; color: var(--studio-muted); font-size: var(--fs-body); }
.needs-view-all { display: inline-block; margin-top: var(--sp-1); color: var(--studio-violet); font-size: var(--fs-kicker); font-weight: 700; text-decoration: none; }
.needs-view-all:hover { text-decoration: underline; }

/* --- Handoffs + independent execution: two distinct, quieter concepts ----- */
.mission-story-body, .independent-execution-body { display: grid; gap: var(--sp-1); }
.story-assignment { padding: var(--sp-2) 0; border-top: 1px solid var(--studio-line-soft); }
.story-attempt { padding: 6px 10px; border-radius: 8px; background: var(--studio-surface-soft); color: var(--studio-muted); }
.story-attempt-state { color: var(--studio-text); font-size: var(--fs-meta); }

/* Independent execution is a secondary surface: a bounded, scannable list of the work that is
   actually running right now, followed by recent unassigned history. Never an endless card feed. */
.independent-execution-body {
  min-width: 0;
  max-height: min(42vh, 340px);      /* bounded so the fold stays about work, not one panel */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--studio-line) transparent;
}
.independent-execution-body:focus-visible { outline: 2px solid var(--studio-violet); outline-offset: 2px; }
.independent-execution-body::-webkit-scrollbar { width: 8px; }
.independent-execution-body::-webkit-scrollbar-thumb { background: var(--studio-line); border-radius: 999px; }
.execution-active-band {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2);
  padding: var(--sp-1) 0 var(--sp-2);
  border-bottom: 1px solid var(--studio-line-soft);
}
.execution-active-count {
  color: var(--studio-green); font-size: var(--fs-lead); font-weight: 700; letter-spacing: -.01em;
  text-transform: none;
}
.execution-active-note { min-width: 0; margin: 0; color: var(--studio-muted); font-size: var(--fs-meta); }
.execution-group-label {
  margin: var(--sp-1) 0 0; color: var(--studio-faint); font-size: var(--fs-kicker);
  text-transform: uppercase; letter-spacing: .08em;
}
.execution-item { padding: var(--sp-2) 0; border-bottom: 1px solid var(--studio-line-soft); }
.execution-item:last-child { border-bottom: 0; }
.execution-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.execution-title { min-width: 0; font-size: 13.5px; color: var(--studio-text); }
.execution-badge {
  flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; font-size: var(--fs-kicker);
  letter-spacing: .04em; text-transform: uppercase; color: var(--studio-faint);
  border: 1px solid var(--studio-line);
}
.execution-item.is-active .execution-badge { color: var(--studio-green); border-color: rgba(111,199,155,.4); background: rgba(111,199,155,.08); }
.execution-item.is-active { box-shadow: inset 2px 0 0 rgba(111,199,155,.55); padding-left: var(--sp-2); }
.execution-state { margin: 3px 0 0; color: var(--studio-muted); font-size: var(--fs-meta); }
.execution-observed { color: var(--studio-faint); font-size: var(--fs-kicker); }
.execution-handoffs { margin: 4px 0 0; color: var(--studio-amber); font-size: var(--fs-meta); }
.execution-freshness-note { margin: var(--sp-2) 0 0; color: var(--studio-amber); font-size: var(--fs-meta); }


/* --- Workbench: dense chips, not giant cards ----------------------------- */
.general-workbench-body { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--sp-2); }
.workbench-item { min-height: 0; padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--studio-line-soft); background: transparent; }
.workbench-label { color: var(--studio-faint); font-size: var(--fs-kicker); letter-spacing: .08em; text-transform: uppercase; }
.workbench-value { margin: var(--sp-1) 0 0; font-size: var(--fs-lead); }

/* --- Details / full room: quiet collapsed affordances -------------------- */
.crew-room-details, .advanced-ops { border: 1px solid var(--studio-line-soft); border-radius: var(--studio-radius); background: rgba(17,21,30,.55); }
.crew-room-details > summary, .advanced-ops > summary { padding: var(--sp-3) var(--sp-4); color: var(--studio-muted); font-size: var(--fs-meta); }
.crew-room-details[open] > summary, .advanced-ops[open] > summary { border-bottom: 1px solid var(--studio-line-soft); color: var(--studio-text); }
.advanced-ops > section { margin: var(--sp-3) var(--sp-4); }

.app-footer { margin: 0; padding-top: var(--sp-2); border-top: 1px solid var(--studio-line-soft); color: var(--studio-faint); font-size: var(--fs-kicker); }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 960px) {
  .studio-main {
    width: min(100% - 28px, 1280px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "mission"
      "needs"
      "story"
      "workbench"
      "compose"
      "exec"
      "council"
      "crew"
      "room"
      "adv"
      "footer";
  }
  .general-workbench-body { grid-template-columns: 1fr 1fr; }
  .mission-heading { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
  .saint-presence { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .studio-main { width: min(100% - 18px, 1280px); padding-top: var(--sp-3); gap: var(--sp-3); }
  .general-workbench-body { grid-template-columns: 1fr; }
  /* Single column follows mission-first order (mission → gates → story → workbench →
     composer → global work → council → crew) so tab order
     matches visual order; the gate tray stays a bounded, reachable ~3-row tray. */
  .needs-you-list { max-height: 140px; }
  .mission-thread { max-height: 38vh; }
  .independent-execution-body { max-height: 360px; }
  .execution-active-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-width: 430px) {
  .needs-you-band { position: sticky; top: 48px; z-index: 28; }
  .studio-main { width: min(100% - 12px, 1280px); }
  .mission-stage, .mission-story-panel, .independent-execution-panel, .workbench-panel, .crew-dock-panel { padding: var(--sp-3); }
  .needs-you-list { max-height: 140px; }
  .execution-active-count { font-size: var(--fs-body); }
}

/* ---- Council bar --------------------------------------------------------
   Abstract gradient orbs only: no faces, no portraits, no mascots. The orb
   conveys the seat accent; the written state conveys the truth. A seat with no
   verified route never pulses, because a pulse would imply a live heartbeat. */
.council-panel{margin:0 0 18px}
.council-bar{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}
.council-seat{position:relative;display:flex;gap:12px;align-items:flex-start;padding:14px;border:1px solid rgba(148,163,184,.18);border-radius:14px;background:rgba(15,19,32,.72)}
.council-orb{flex:0 0 auto;width:26px;height:26px;border-radius:50%;background:radial-gradient(circle at 32% 28%,rgba(255,255,255,.55),rgba(255,255,255,0) 58%),var(--orb-base,#64748b);box-shadow:0 0 0 1px rgba(255,255,255,.08) inset;filter:saturate(.85)}
.orb-blue-violet{--orb-base:linear-gradient(140deg,#60a5fa,#8b5cf6)}
.orb-amber{--orb-base:linear-gradient(140deg,#fbbf24,#f59e0b)}
.orb-green{--orb-base:linear-gradient(140deg,#4ade80,#22c55e)}
.orb-teal{--orb-base:linear-gradient(140deg,#2dd4bf,#0d9488)}
.orb-blue{--orb-base:linear-gradient(140deg,#93c5fd,#3b82f6)}
.council-body{min-width:0;display:flex;flex-direction:column;gap:3px}
.council-name{font-size:.95rem;color:#e8edf7}
.council-state{font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;color:#94a3b8}
.seat-live .council-state{color:#4ade80}
.seat-waiting .council-state{color:#fbbf24}
.seat-stale .council-state{color:#94a3b8}
.seat-no_route .council-state{color:#f87171}
.council-detail{margin:0;font-size:.82rem;line-height:1.4;color:#a8b3c7}
.council-observed{font-size:.72rem;color:#7c8798}
/* Only a genuinely live seat breathes. Everything else stays still and legible. */
.seat-live .council-orb{animation:council-breathe 3.4s ease-in-out infinite}
.seat-stale .council-orb,.seat-no_route .council-orb{opacity:.55;filter:saturate(.35)}
@keyframes council-breathe{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.06);opacity:.88}}
@media (prefers-reduced-motion:reduce){.seat-live .council-orb{animation:none}}
@media (max-width:640px){.council-bar{grid-template-columns:1fr 1fr}.council-seat{padding:11px}}

/* Brokered Council Room: every bubble is backed by an append-only dispatch/reply event. */
.council-room-panel{display:grid;gap:14px;margin:0 0 18px;padding:18px;border:1px solid rgba(148,163,184,.18);border-radius:18px;background:linear-gradient(145deg,rgba(17,22,38,.96),rgba(12,16,28,.92));box-shadow:0 16px 42px rgba(0,0,0,.18)}
.council-seat-list{display:flex;flex-wrap:wrap;gap:8px}
.council-seat-toggle{display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid rgba(148,163,184,.2);border-radius:999px;background:rgba(31,38,61,.68);cursor:pointer;color:var(--studio-text,#e8edf7)}
.council-seat-toggle input{accent-color:#8e74ff}.council-seat-toggle-copy{display:grid;gap:2px}.council-seat-toggle-state{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:#aab4c8}.council-seat-reachable .council-seat-toggle-state,.council-seat-live .council-seat-toggle-state{color:#59df93}.council-seat-manual .council-seat-toggle-state,.council-seat-waiting .council-seat-toggle-state{color:#f6c45b}.council-seat-unavailable .council-seat-toggle-state,.council-seat-no_route .council-seat-toggle-state{color:#ff8c8c}
.council-room-timeline{display:grid;gap:12px;max-height:560px;overflow:auto;padding:2px}
.council-message{display:grid;gap:10px;padding:14px;border:1px solid rgba(148,163,184,.2);border-radius:14px;background:rgba(9,13,24,.62)}
.council-message-head,.council-reply-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.council-message-head time,.council-reply-head time{margin-left:auto;color:#7f8ba4;font-size:11px}.council-message-status,.council-reply-status{padding:3px 7px;border-radius:999px;background:rgba(148,163,184,.14);color:#b9c2d4;font-size:10px;letter-spacing:.05em;text-transform:uppercase}.council-status-complete,.council-status-replied{color:#63e19c;background:rgba(59,190,119,.13)}.council-status-dispatching,.council-status-pending,.council-status-manual{color:#f7c968;background:rgba(232,174,59,.13)}.council-status-degraded,.council-status-failed,.council-status-unavailable{color:#ff9999;background:rgba(220,85,85,.13)}
.council-message-copy,.council-reply-copy{margin:0;color:#f1f4fb;line-height:1.5;white-space:pre-wrap}.council-replies{display:grid;gap:8px;padding-left:14px;border-left:2px solid rgba(142,116,255,.35)}.council-reply{display:grid;gap:5px;padding:10px 12px;border:1px solid rgba(148,163,184,.14);border-radius:11px;background:rgba(27,34,54,.55)}.council-reply-detail{margin:0;color:#9da9bd;font-size:11px;line-height:1.4}.council-empty{margin:0;color:#8e9ab0;font-size:12px}.council-room-form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px}.council-room-form textarea{width:100%;min-height:54px;resize:vertical;padding:11px 12px;border:1px solid rgba(142,154,214,.24);border-radius:13px;background:rgba(25,30,53,.86);color:#f4f5fb;font:inherit;font-size:13px;line-height:1.45;outline:none}.council-room-form textarea:focus{border-color:rgba(148,116,255,.7);box-shadow:0 0 0 3px rgba(148,116,255,.1)}.council-room-form .send-task-button{min-width:126px}.council-room-form .composer-help{grid-column:1/-1}
@media (max-width:640px){.council-room-panel{padding:13px}.council-room-form{grid-template-columns:1fr}.council-room-form .send-task-button{min-height:42px}.council-replies{padding-left:8px}}
.mission-compose-panel{grid-area:compose;min-width:0;padding:var(--sp-3);border:1px solid var(--studio-line);border-radius:var(--studio-radius);background:var(--studio-surface)}
.mission-compose-panel h2{margin:0 0 var(--sp-2);font-size:var(--fs-title)}
.workbench-list li{overflow-wrap:anywhere}.workbench-evidence{display:block;margin:6px 0;font-size:12px;color:var(--studio-muted)}
.workbench-evidence a{color:#c7bfff;text-decoration:underline}.workbench-expand{margin-top:8px;color:var(--studio-text)}
.studio-main>section{scroll-margin-top:110px}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
