/* Ghost OS UI v4.6 QA fixes: scope-consistent Cortex, portrait Memory Viewer and quieter diagnostics. */

/* Cortex: let the eight-stage pipeline own the full width, then pair operations beneath it. */
#ghostMemoryLabV2 .memlab-grid.ghost-cortex-layout{
  grid-template-columns:minmax(0,1.35fr) minmax(300px,.78fr)!important;
  gap:16px!important;
  align-items:start!important;
}
#ghostMemoryLabV2 .memlab-grid.ghost-cortex-layout>.memlab-stack{display:contents!important}
#ghostMemoryLabV2 .ghost-cortex-pipeline-card{grid-column:1/-1!important;grid-row:1!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-runs-card{grid-column:1!important;grid-row:2!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-controls-card{grid-column:2!important;grid-row:2!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-ledger-card{grid-column:1!important;grid-row:3!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-guardrails-card{grid-column:2!important;grid-row:3!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-architecture-card{grid-column:1!important;grid-row:4!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-qa-card{grid-column:2!important;grid-row:4!important;min-width:0!important}
#ghostMemoryLabV2 .ghost-cortex-pipeline-card .memlab-pipeline.a5-pipeline{
  grid-template-columns:repeat(8,minmax(0,1fr))!important;
  overflow:hidden!important;
  width:100%!important;
  min-width:0!important;
}
#ghostMemoryLabV2 .ghost-cortex-pipeline-card .memlab-stage{min-width:0!important;overflow:hidden!important}
#ghostMemoryLabV2 .ghost-cortex-pipeline-card .memlab-stage small{overflow-wrap:anywhere!important}
#ghostMemoryLabV2 .ghost-cortex-controls-card .memlab-form-grid{grid-template-columns:1fr!important}
#ghostMemoryLabV2 .ghost-cortex-controls-card .memlab-field select{width:100%!important;min-width:0!important}

body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .memlab-grid.ghost-cortex-layout,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .memlab-grid.ghost-cortex-layout{grid-template-columns:1fr!important}
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-pipeline-card,
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-runs-card,
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-controls-card,
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-ledger-card,
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-guardrails-card,
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-architecture-card,
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-qa-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-pipeline-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-runs-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-controls-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-ledger-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-guardrails-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-architecture-card,
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-qa-card{grid-column:1!important;grid-row:auto!important}
body[data-ghost-main-width="medium"] #ghostMemoryLabV2 .ghost-cortex-pipeline-card .memlab-pipeline.a5-pipeline{grid-template-columns:repeat(4,minmax(0,1fr))!important}
body[data-ghost-main-width="compact"] #ghostMemoryLabV2 .ghost-cortex-pipeline-card .memlab-pipeline.a5-pipeline{grid-template-columns:repeat(2,minmax(0,1fr))!important}

/* Run cards keep the useful result summary visible and put model monologues behind disclosure. */
#ghostMemoryLabV2 .memlab-run-top>.memlab-badge{white-space:nowrap!important;min-width:max-content!important;flex:0 0 auto!important;align-self:flex-start!important}
#ghostMemoryLabV2 .memlab-run-top .memlab-meta{white-space:normal!important;overflow-wrap:anywhere!important}
.ghost-run-diagnostics{margin-top:10px;border-top:1px solid rgba(var(--accent-rgb),.075);padding-top:7px}
.ghost-run-diagnostics>summary{cursor:pointer;color:#7390a7;font-size:.64rem;font-weight:700;letter-spacing:.025em;list-style-position:inside;padding:4px 0}
.ghost-run-diagnostics[open]>summary{color:#b9d5e5}
.ghost-run-diagnostics-body{display:grid;gap:7px;padding:5px 0 2px}
.ghost-run-diagnostics-body .memlab-note{margin:0!important;padding:8px 9px!important;border:1px solid rgba(var(--accent-rgb),.07);border-radius:9px;background:rgba(2,12,21,.35);font-size:.66rem!important;line-height:1.5!important}
.ghost-run-diagnostics-body .a5-trace{margin-top:0!important}

/* Scope-synchronised lineage replaces the old active-chat-only upper panel data. */
.ghost-cortex-scope-lineage{padding-top:4px}
.ghost-cortex-empty-lineage{margin-top:9px}

/* Memory Viewer: compact mode must remain in normal flow and never manufacture horizontal scroll. */
.memory-manager-panel,.ghost-memory-browser,#memoryList,.memory-card,.ghost-memory-inspector{box-sizing:border-box;min-width:0}
.memory-manager-panel{overflow-x:hidden!important}
.memory-list{overflow-x:hidden!important}
body[data-ghost-main-width="compact"] .ghost-memory-browser{
  display:flex!important;
  flex-direction:column!important;
  gap:12px!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:visible!important;
  padding:0 12px 18px!important;
}
body[data-ghost-main-width="compact"] .ghost-memory-inspector{
  order:-1!important;
  position:relative!important;
  inset:auto!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  max-height:none!important;
  overflow:visible!important;
  align-self:stretch!important;
}
body[data-ghost-main-width="compact"] .ghost-memory-browser #memoryList{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:visible!important;
}
body[data-ghost-main-width="compact"] .memory-card{width:100%!important;max-width:100%!important;overflow:hidden!important;transform:none!important}
body[data-ghost-main-width="compact"] .memory-card-top{min-width:0!important;flex-wrap:wrap!important}
body[data-ghost-main-width="compact"] .memory-badges{min-width:0!important;max-width:100%!important}
body[data-ghost-main-width="compact"] .memory-meta,
body[data-ghost-main-width="compact"] .memory-content,
body[data-ghost-main-width="compact"] .memory-key{max-width:100%!important;overflow-wrap:anywhere!important;word-break:break-word!important}
body[data-ghost-main-width="compact"] .ghost-memory-properties>div{grid-template-columns:minmax(72px,92px) minmax(0,1fr)!important}

/* Audit history is useful evidence, not mandatory wallpaper. */
.ghost-memory-audit-details{border-top:1px solid rgba(var(--accent-rgb),.08);padding-top:7px}
.ghost-memory-audit-details>summary{cursor:pointer;padding:6px 0;color:#718ba1;font-size:.61rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;list-style-position:inside}
.ghost-memory-audit-details[open]>summary{color:#b9d4e3}
.ghost-memory-event-payload{margin-top:4px}
.ghost-memory-event-payload>summary{cursor:pointer;color:#617d92;font-size:.56rem}
.ghost-memory-event-payload code{display:block;margin-top:5px;padding:7px;border:1px solid rgba(var(--accent-rgb),.07);border-radius:8px;background:rgba(1,8,14,.6);color:#7893a6;font:500 .55rem/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
.ghost-memory-event strong{overflow-wrap:anywhere}

/* Status centre: informational/observed Vectorize state can be cyan instead of warning amber. */
.ghost-status-metric.info strong{color:#70d9f1}
