/* Mind Atlas v2 (prototype). Calm charcoal-navy chrome; only the atlas glows. Colours are tokens; domain colours arrive as --dc. */
:root {
  --bg: #070a13; --bg-2: #0a0e19; --panel: #0b101b; --panel-2: #10162a; --raise: rgba(255,255,255,.028);
  --line: rgba(150,170,225,.10); --line-2: rgba(150,170,225,.18); --line-3: rgba(150,170,225,.30);
  --text: #e8edfa; --muted: #8b95b0; --faint: #5d6886;
  --accent: #6aa7ff; --accent-soft: rgba(80,125,235,.16); --accent-line: rgba(110,155,255,.42);
  --ok: #45d9a0; --warn: #f0b560; --danger: #ff7a93; --violet: #a68bff; --cyan: #5fe0ec;
  --focus: #9cc0ff; --r: 12px; --r-sm: 8px;
  --nav-w: 224px; --panel-w: 392px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22,.7,.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: #04101f; padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.boot { padding: 40px; color: var(--muted); }

/* honest-data strip: present on every screen at every width */
.sample-strip { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 4px 12px; background: rgba(240,181,96,.09); border-bottom: 1px solid rgba(240,181,96,.28); color: #f0c27c; font-size: 11.5px; letter-spacing: .02em; text-align: center; }
.sample-strip b { letter-spacing: .12em; font-weight: 700; white-space: nowrap; }
.sample-strip span { color: #c9a26a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--panel-w); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top top" "nav main panel"; min-height: 0; background: radial-gradient(1200px 700px at 55% 40%, rgba(60,70,160,.10), transparent 60%), var(--bg); }
.app[data-mode="other"] { grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-areas: "top top" "nav main"; }
.app[data-mode="other"] .panel { display: none; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: rgba(8,11,20,.88); min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; width: calc(var(--nav-w) - 18px); flex: none; }
.logo { color: #9ec3ff; display: grid; place-items: center; }
.brand b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand small { display: block; font-size: 9.5px; letter-spacing: .42em; color: var(--muted); margin-top: 2px; }
.metrics { display: flex; gap: 10px; flex: 0 1 auto; min-width: 0; }
.metric { display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raise); min-width: 0; }
.metric .mi { color: #8fb4f5; display: grid; place-items: center; width: 28px; }
.metric b { display: block; font-size: 17px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .mt span { display: block; font-size: 9.5px; letter-spacing: .14em; color: var(--muted); }
.pill-btn { display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raise); text-align: left; margin-left: auto; flex: none; }
.pill-btn:hover { border-color: var(--line-3); }
.pill-btn .pi { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #9b7bff, #4a2fb0); color: #fff; }
.pill-btn small { display: block; font-size: 9.5px; letter-spacing: .14em; color: var(--muted); }
.pill-btn b { display: block; font-size: 11px; letter-spacing: .12em; font-weight: 600; color: #cdb9ff; white-space: nowrap; }
.pill-btn[data-state="ready"] b { color: #f0c27c; } .pill-btn[data-state="done"] b { color: var(--ok); }
.pill-btn[data-state="run"] .pi { animation: breathe 1.6s ease-in-out infinite; }
.searchtop { display: flex; align-items: center; gap: 8px; width: 290px; max-width: 100%; flex: 0 1 290px; padding: 0 12px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raise); color: var(--muted); }
.searchtop:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(80,125,235,.14); }
.searchtop input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; }
.searchtop input::placeholder { color: var(--muted); }
kbd { font: 600 10.5px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 6px; background: rgba(255,255,255,.03); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: radial-gradient(circle at 30% 25%, #6c8cff, #2c3a8a); border: 1px solid var(--line-3); }
.bell { position: relative; } .bell .badge { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: #ff9a5c; }

/* ---------- left nav ---------- */
.sidenav { grid-area: nav; display: flex; flex-direction: column; justify-content: space-between; padding: 14px 12px 14px; border-right: 1px solid var(--line); overflow-y: auto; min-height: 0; background: rgba(8,11,20,.55); }
.nav-list { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; border: 1px solid transparent; background: none; border-radius: 10px; color: #c3cbe2; text-align: left; transition: background .2s var(--ease), border-color .2s var(--ease), color .2s; }
.nav-item .ico { color: #8d9ab8; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-item[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent-line); color: #fff; }
.nav-item[aria-current="page"] .ico { color: #a9c6ff; }
.brain-status { padding: 16px 8px 4px; border-top: 1px solid var(--line); margin-top: 16px; font-size: 12.5px; }
.brain-status h2 { font-size: 10.5px; letter-spacing: .16em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.online { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 500; }
.online i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(69,217,160,.7); }
.bar-row { display: flex; justify-content: space-between; margin: 8px 0 5px; color: #c3cbe2; }
.bar-row b { font-weight: 500; font-variant-numeric: tabular-nums; }
.bar { display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar b { display: block; height: 100%; width: var(--w, 50%); background: linear-gradient(90deg, #2bd1b0, #4fe0c0); border-radius: 4px; transition: width .6s var(--ease); }
.spark { width: 100%; height: 34px; display: block; margin-top: 4px; }
.spark-line { fill: none; stroke: #36d3b3; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark-fill { fill: rgba(54,211,179,.10); stroke: none; }

.main { grid-area: main; min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); }
.tabbar, .more-sheet, .scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1499px) {
  .metric .mi { display: none; } .metric { padding: 7px 12px; }
  .searchtop { flex-basis: 230px; width: 230px; }
}
@media (max-width: 1279px) {
  :root { --nav-w: 196px; --panel-w: 346px; }
  .brand { width: auto; } .nav-item { padding: 0 11px; gap: 12px; }
  .metrics { gap: 6px; } .metric { padding: 6px 10px; } .metric b { font-size: 15px; }
  .searchtop { flex-basis: 180px; width: 180px; } .searchtop kbd { display: none; }
  .pill-btn small { display: none; }
}
@media (max-width: 1200px) {
  .topbar { gap: 10px; }
  .metrics { order: 9; width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; } .metric { flex: 1 0 auto; justify-content: center; }
  .metric .mt { display: flex; align-items: baseline; gap: 8px; } .metric b { display: inline; }
  .searchtop { flex: 1 1 200px; width: auto; } .pill-btn { margin-left: 0; }
}
@media (max-width: 1000px) {
  :root { --nav-w: 68px; }
  .app, .app[data-mode="other"] { grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-areas: "top top" "nav main"; }
  .nav-item { justify-content: center; padding: 0; } .nav-item span { display: none; }
  .brain-status { display: none; }
  .topbar { gap: 10px; }
  .metrics { order: 9; width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; } .metric { flex: 1 0 auto; justify-content: center; }
  .metric .mt { display: flex; align-items: baseline; gap: 8px; } .metric b { display: inline; }
  .searchtop { flex: 1 1 200px; width: auto; } .pill-btn { margin-left: 0; }
  .panel { position: fixed; z-index: 40; top: 0; bottom: 0; right: 0; width: min(420px, 94vw); transform: translateX(104%); transition: transform .32s var(--ease); box-shadow: -20px 0 60px rgba(0,0,0,.5); }
  .panel.open { transform: none; }
  .scrim.on { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(3,5,12,.6); }
  .inspect-fab { display: inline-flex !important; }
  .panel-close { display: inline-grid !important; }
}
@media (max-width: 700px) {
  .app, .app[data-mode="other"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top" "main" "tab"; }
  .sidenav { display: none; }
  .tabbar { grid-area: tab; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line-2); background: rgba(8,11,20,.96); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar-item { display: grid; justify-items: center; gap: 2px; padding: 6px 0; background: none; border: 0; border-radius: 10px; color: var(--muted); font-size: 10.5px; min-height: 48px; }
  .tabbar-item[aria-current="page"] { color: #fff; background: var(--accent-soft); }
  .more-sheet { position: fixed; z-index: 45; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); display: grid; width: 210px; padding: 6px; border: 1px solid var(--line-3); border-radius: 14px; background: var(--panel-2); box-shadow: 0 20px 50px rgba(0,0,0,.55); }
  .more-sheet[hidden] { display: none; }
  .more-sheet button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; background: none; border: 0; border-radius: 10px; text-align: left; }
  .more-sheet button:hover { background: rgba(255,255,255,.05); }
  .brand div { display: none; } .brand { width: auto; }
  .topbar { padding: 8px 12px; min-height: 0; gap: 8px; } .searchtop { height: 38px; flex-basis: 120px; }
  .pill-btn { padding: 5px 8px; } .pill-btn b { font-size: 9.5px; letter-spacing: .06em; } .pill-btn .pi { width: 24px; height: 24px; }
  .bell { display: none; }
  .panel { top: auto; left: 0; right: 0; width: 100%; height: min(82dvh, 700px); border-radius: 18px 18px 0 0; transform: translateY(104%); box-shadow: 0 -20px 60px rgba(0,0,0,.55); }
  .panel.open { transform: none; }
  .sample-strip span { display: none; }
  .sample-strip { padding: 3px 8px; font-size: 10.5px; }
}
/* ---------- reduced motion (manual toggle OR OS setting) ---------- */
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) *, html:not([data-motion="full"]) *::before { animation: none !important; transition: none !important; } }
@keyframes breathe { 0%,100% { box-shadow: 0 0 0 0 rgba(155,123,255,.55); } 50% { box-shadow: 0 0 0 7px rgba(155,123,255,0); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.ico { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
