/* APEX Intelligence workspace. This file is inert until Max is active. */
html[data-tier="max"] .mx-memory-workspace { height: calc(100vh - 40px); min-height: 640px; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); color: var(--text); }
html[data-tier="max"] .mx-memory-workspace { position: relative; }
html[data-tier="max"] .mx-memory-toolbar { flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--border-soft); background: var(--surface); }
html[data-tier="max"] .mx-memory-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
html[data-tier="max"] .mx-memory-title h1 { margin: 0; font-size: 20px; font-weight: 650; }
html[data-tier="max"] .mx-memory-count { color: var(--muted2); font: 11px var(--font-mono); }
html[data-tier="max"] .mx-memory-tools { display: flex; align-items: center; gap: 8px; }
html[data-tier="max"] .mx-memory-search { display: flex; align-items: center; gap: 8px; width: 220px; height: 32px; padding: 0 10px; border: 1px solid var(--border-soft); border-radius: 4px; background: var(--surface2); color: var(--muted); }
html[data-tier="max"] .mx-memory-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 12px var(--font-body); }
html[data-tier="max"] .mx-memory-tool { height: 32px; padding: 0 12px; border: 1px solid var(--border-soft); border-radius: 4px; background: var(--surface2); color: var(--muted); font-size: 11px; cursor: pointer; }
html[data-tier="max"] .mx-memory-tool:hover { border-color: var(--border); color: var(--text); }
html[data-tier="max"] .mx-memory-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr) 310px; min-height: 0; flex: 1; }
html[data-tier="max"] .mx-memory-sidebar { padding: 20px 10px; border-right: 1px solid var(--border-soft); background: var(--surface2); }
html[data-tier="max"] .mx-memory-sidebar-head { display: flex; justify-content: space-between; padding: 0 10px 14px; font-size: 12px; font-weight: 650; }
html[data-tier="max"] .mx-memory-live { color: var(--green); font: 9px var(--font-mono); }
html[data-tier="max"] .mx-memory-filter { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 9px 10px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 12px; text-align: left; cursor: pointer; }
html[data-tier="max"] .mx-memory-filter b { color: var(--muted2); font: 10px var(--font-mono); }
html[data-tier="max"] .mx-memory-filter:hover, html[data-tier="max"] .mx-memory-filter.is-active { background: var(--surface3); color: var(--text); }
html[data-tier="max"] .mx-memory-filter.is-active { box-shadow: inset 2px 0 var(--mx-gold); }
html[data-tier="max"] .mx-memory-sidebar-note { margin: 26px 10px 0; padding-top: 14px; border-top: 1px solid var(--border-soft); color: var(--muted2); font-size: 10px; line-height: 1.55; }
html[data-tier="max"] .mx-memory-canvas { position: relative; min-width: 0; overflow: hidden; background: var(--surface); }
html[data-tier="max"] .mx-memory-canvas::before { position: absolute; inset: 0; pointer-events: none; content: ""; opacity: .42; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M32 0H0V32' fill='none' stroke='%23858b93' stroke-opacity='.16'/%3E%3C/svg%3E"); }
html[data-tier="max"] .mx-memory-canvas-head { position: absolute; z-index: 2; top: 16px; left: 20px; right: 20px; display: flex; justify-content: space-between; color: var(--muted2); text-transform: uppercase; letter-spacing: .12em; font: 10px var(--font-mono); }
html[data-tier="max"] .mx-memory-svg { position: relative; z-index: 1; width: 100%; height: 100%; min-height: 400px; touch-action: none; cursor: grab; }
html[data-tier="max"] .mx-memory-svg:active { cursor: grabbing; }
html[data-tier="max"] .mx-memory-legend { position: absolute; z-index: 2; left: 20px; bottom: 16px; display: flex; gap: 14px; padding: 8px 10px; border: 1px solid var(--border-soft); background: var(--surface2); color: var(--muted); font: 10px var(--font-mono); }
html[data-tier="max"] .mx-memory-legend span { display: flex; align-items: center; gap: 5px; }
html[data-tier="max"] .mx-memory-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
html[data-tier="max"] .mx-memory-legend .is-pattern { background: var(--green); }
html[data-tier="max"] .mx-memory-legend .is-hypothesis { background: var(--red); }
html[data-tier="max"] .mx-memory-legend .is-rule { background: var(--amber); }
html[data-tier="max"] .mx-memory-legend .is-decision { background: var(--blue); }
html[data-tier="max"] .mx-memory-edge { stroke: var(--border); stroke-width: 1; opacity: .6; }
html[data-tier="max"] .mx-memory-edge.is-related { stroke: var(--mx-gold); stroke-width: 2; opacity: 1; }
html[data-tier="max"] .mx-memory-node { cursor: pointer; outline: 0; }
html[data-tier="max"] .mx-memory-node circle { fill: var(--surface3); stroke: var(--muted2); stroke-width: 1.5; }
html[data-tier="max"] .mx-memory-node.is-pattern circle { fill: var(--green); stroke: var(--green); }
html[data-tier="max"] .mx-memory-node.is-hypothesis circle { fill: var(--red); stroke: var(--red); }
html[data-tier="max"] .mx-memory-node.is-personal_rule circle { fill: var(--amber); stroke: var(--amber); }
html[data-tier="max"] .mx-memory-node:hover circle, html[data-tier="max"] .mx-memory-node:focus circle, html[data-tier="max"] .mx-memory-node.is-selected circle { stroke: var(--mx-gold); stroke-width: 2; }
html[data-tier="max"] .mx-memory-node.is-selected circle { r: 10; }
html[data-tier="max"] .mx-memory-node-type, html[data-tier="max"] .mx-memory-node-label { opacity: 0; pointer-events: none; transition: opacity .15s ease; }
html[data-tier="max"] .mx-memory-node:hover .mx-memory-node-type, html[data-tier="max"] .mx-memory-node:hover .mx-memory-node-label, html[data-tier="max"] .mx-memory-node:focus .mx-memory-node-type, html[data-tier="max"] .mx-memory-node:focus .mx-memory-node-label, html[data-tier="max"] .mx-memory-node.is-selected .mx-memory-node-type, html[data-tier="max"] .mx-memory-node.is-selected .mx-memory-node-label { opacity: 1; }
html[data-tier="max"] .mx-memory-node-type { fill: var(--muted2); letter-spacing: .08em; font: 9px var(--font-mono); }
html[data-tier="max"] .mx-memory-node-label { fill: var(--text); font: 12px var(--font-body); font-weight: 600; }
html[data-tier="max"] .mx-memory-node-value { fill: var(--muted); font: 10px var(--font-mono); }
html[data-tier="max"] .mx-memory-inspector { min-width: 0; overflow: auto; padding: 22px; border-left: 1px solid var(--border-soft); background: var(--surface2); }
html[data-tier="max"] .mx-memory-empty { margin-top: 42vh; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
html[data-tier="max"] .mx-memory-empty small { color: var(--muted2); }
html[data-tier="max"] .mx-memory-inspector-top { display: flex; align-items: center; justify-content: space-between; }
html[data-tier="max"] .mx-memory-inspector-top button { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
html[data-tier="max"] .mx-memory-type { color: var(--mx-gold); letter-spacing: .1em; font: 9px var(--font-mono); }
html[data-tier="max"] .mx-memory-inspector h2 { margin: 18px 0 8px; font-size: 18px; line-height: 1.25; }
html[data-tier="max"] .mx-memory-meta { margin: 0; color: var(--muted2); font: 10px var(--font-mono); }
html[data-tier="max"] .mx-memory-statement { margin: 22px 0; padding-bottom: 20px; border-bottom: 1px solid var(--border-soft); color: var(--muted); font-size: 12px; line-height: 1.6; }
html[data-tier="max"] .mx-memory-evidence b, html[data-tier="max"] .mx-memory-relations > b { display: block; margin-bottom: 10px; color: var(--muted2); text-transform: uppercase; letter-spacing: .08em; font: 10px var(--font-mono); }
html[data-tier="max"] .mx-memory-evidence p { margin: 0 0 20px; color: var(--text); font-size: 11px; line-height: 1.55; }
html[data-tier="max"] .mx-memory-relations button { display: flex; width: 100%; flex-direction: column; gap: 3px; padding: 9px 0; border: 0; border-top: 1px solid var(--border-soft); background: transparent; text-align: left; cursor: pointer; }
html[data-tier="max"] .mx-memory-relations button span { color: var(--muted2); font: 9px var(--font-mono); }
html[data-tier="max"] .mx-memory-relations button strong { color: var(--text); font-size: 11px; font-weight: 550; }
html[data-tier="max"] .mx-memory-relations button:hover strong { color: var(--mx-gold); }
@media (min-width: 901px) {
	html[data-tier="max"] .content-scroll > main:has(> #view-intelligence.active) { max-width: none; margin: 0; padding: 0; }
	html[data-tier="max"] #view-intelligence.active { min-height: 100vh; }
}
@media (max-width: 900px) {
	html[data-tier="max"] .mx-memory-layout { grid-template-columns: 170px minmax(0, 1fr); }
	html[data-tier="max"] .mx-memory-inspector { position: absolute; z-index: 5; top: 64px; right: 0; bottom: 0; width: min(310px, 88vw); }
	html[data-tier="max"] .mx-memory-inspector:has(.mx-memory-empty) { display: none; }
}
@media (max-width: 640px) {
	html[data-tier="max"] .mx-memory-workspace { height: calc(100vh - 16px); min-height: 520px; }
	html[data-tier="max"] .mx-memory-toolbar { padding: 0 12px; }
	html[data-tier="max"] .mx-memory-tools { flex: 1; justify-content: flex-end; }
	html[data-tier="max"] .mx-memory-search { width: 150px; }
	html[data-tier="max"] .mx-memory-title .mx-memory-count { display: none; }
	html[data-tier="max"] .mx-memory-layout { display: block; }
	html[data-tier="max"] .mx-memory-sidebar { position: absolute; z-index: 4; top: 64px; bottom: 0; left: 0; width: 150px; transform: translateX(-100%); transition: transform .2s; }
	html[data-tier="max"] .mx-memory-sidebar:focus-within, html[data-tier="max"] .mx-memory-sidebar:hover { transform: translateX(0); }
	html[data-tier="max"] .mx-memory-canvas { height: 100%; }
	html[data-tier="max"] .mx-memory-legend { left: 10px; gap: 7px; }
	html[data-tier="max"] .mx-memory-legend span:nth-child(n + 3) { display: none; }
}
