/* Apollo Brain — NEURAL-GLOW brand skin (Вячеслав 2026-07-21: серо-чёрный монохром
   был «серой кашей», вернуть яркий фирменный стиль главной apolloproduction.studio).
   Palette lifted from orchids-projects/project/src/index.css: тёмный премиум-фон +
   ЯРКИЕ фирменные акценты cyan→violet→fuchsia, свечение, градиенты. Node/category
   colours остаются как DATA-маркеры; теперь ими же светятся связи и активные вкладки. */
:root {
  /* premium dark ground — faint violet cast, never flat grey */
  --bg: #08080d;
  --bg-2: #0e0e16;
  --bg-3: #14141f;
  --panel: rgba(18, 18, 28, 0.66);
  --panel-2: rgba(24, 24, 38, 0.78);
  --line: #1e1e2c;
  --stroke: #262635;
  --stroke-2: #363650;
  --text: #f2f2f8;
  --muted: #a3a3b8;
  --dim: #6b6b82;

  /* ---- Apollo neural-glow brand accents (cyan → violet → fuchsia) ---- */
  --c-cyan: #22d3ee;
  --c-blue: #5b9dff;
  --c-violet: #a855f7;
  --c-fuchsia: #d946ef;
  --c-pink: #ff8ac2;
  --accent: #a855f7;      /* primary interactive */
  --accent-2: #d946ef;    /* secondary / glow */
  --accent-rgb: 168, 85, 247;
  --grad: linear-gradient(120deg, #22d3ee 0%, #a855f7 52%, #d946ef 100%);
  --grad-soft: linear-gradient(120deg, rgba(34,211,238,0.16), rgba(168,85,247,0.16) 55%, rgba(217,70,239,0.16));

  /* node category colours — DATA markers (legend dots, graph nodes, edges) */
  --person: #ff8ac2; --model: #c084fc; --site: #5b9dff; --service: #22d3ee;
  --bot: #34e2b4; --decision: #ffb454; --concept: #93a4c8;
  /* semantic states */
  --green: #34d399; --amber: #ffb020; --red: #ff4d6d;

  --radius: 15px;
  --shadow: 0 26px 74px -26px rgba(0, 0, 0, 0.85);
  font-synthesis: none;
  accent-color: #a855f7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.1px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(168, 85, 247, 0.34); color: #fff; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.28); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, 0.5); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- animated neural gradient mesh — the brand signature, GPU-cheap ---- */
.bg-mesh {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 42% at 18% 12%, rgba(34, 211, 238, 0.20), transparent 62%),
    radial-gradient(42% 46% at 82% 22%, rgba(168, 85, 247, 0.22), transparent 64%),
    radial-gradient(46% 50% at 62% 92%, rgba(217, 70, 239, 0.18), transparent 66%),
    radial-gradient(40% 44% at 8% 88%, rgba(91, 157, 255, 0.14), transparent 64%);
  filter: blur(30px) saturate(120%);
  animation: mesh-drift 26s ease-in-out infinite;
}
@keyframes mesh-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(2.5%, -2%, 0) scale(1.06); }
  66% { transform: translate3d(-2%, 2.5%, 0) scale(1.03); }
}
/* faint grid over the mesh for depth */
.bg-mesh::after {
  content: ""; position: absolute; inset: 0; opacity: 0.5;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px) 0 0 / 46px 46px;
  -webkit-mask: radial-gradient(70% 60% at 50% 40%, #000, transparent 85%);
  mask: radial-gradient(70% 60% at 50% 40%, #000, transparent 85%);
}
@media (prefers-reduced-motion: reduce) { .bg-mesh { animation: none; } }

.app { position: relative; z-index: 1; display: grid; grid-template-columns: 244px 1fr; height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  border-right: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(16, 16, 26, 0.82), rgba(8, 8, 13, 0.9));
  display: flex; flex-direction: column; padding: 22px 15px; gap: 6px;
  backdrop-filter: blur(14px);
  position: relative;
}
/* luminous brand rail on the sidebar edge */
.sidebar::after {
  content: ""; position: absolute; top: 0; right: -1px; width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(168,85,247,0.5) 30%, rgba(34,211,238,0.4) 70%, transparent);
  opacity: 0.7;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand .mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none; position: relative;
  background: var(--grad); background-size: 160% 160%;
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 8px 24px -6px rgba(168,85,247,0.6), inset 0 1px 0 rgba(255,255,255,0.3);
  animation: mark-glow 6s ease-in-out infinite;
}
@keyframes mark-glow {
  0%, 100% { background-position: 0% 50%; box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 8px 24px -6px rgba(168,85,247,0.55), inset 0 1px 0 rgba(255,255,255,0.3); }
  50% { background-position: 100% 50%; box-shadow: 0 0 0 1px rgba(255,255,255,0.16), 0 10px 30px -6px rgba(217,70,239,0.7), inset 0 1px 0 rgba(255,255,255,0.35); }
}
.brand .mark svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.brand .title { font-weight: 750; font-size: 16px; letter-spacing: 0.1px; }
.brand .title b {
  background: var(--grad); background-size: 200% auto; -webkit-background-clip: text;
  background-clip: text; color: transparent; animation: shimmer-text 7s linear infinite;
}
@keyframes shimmer-text { to { background-position: 200% center; } }
.brand .title span { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0.4px; margin-top: 1px; -webkit-text-fill-color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; position: relative;
  padding: 9px 11px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 560;
  cursor: pointer; transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); text-align: left; font-family: inherit;
}
/* custom-icon chip — glass tile; the inline SVG inherits the tab's accent colour */
.nav button .ico {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--stroke); color: var(--muted);
}
.nav button .ico svg { width: 18px; height: 18px; display: block; }
.nav button:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav button:hover .ico { border-color: var(--stroke-2); transform: translateY(-1px); color: var(--tab-accent, var(--accent)); }
.nav button.active {
  color: #fff;
  background: linear-gradient(100deg, color-mix(in srgb, var(--tab-accent, var(--accent)) 18%, transparent), rgba(255, 255, 255, 0.02));
  border-color: color-mix(in srgb, var(--tab-accent, var(--accent)) 42%, var(--stroke));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 26px -18px color-mix(in srgb, var(--tab-accent, var(--accent)) 90%, transparent);
}
.nav button.active::before {
  content: ""; position: absolute; left: -15px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: var(--tab-accent, var(--accent)); box-shadow: 0 0 12px var(--tab-accent, var(--accent));
}
.nav button.active .ico {
  color: #fff;
  background: color-mix(in srgb, var(--tab-accent, var(--accent)) 26%, transparent);
  border-color: color-mix(in srgb, var(--tab-accent, var(--accent)) 55%, transparent);
  box-shadow: 0 0 16px -2px color-mix(in srgb, var(--tab-accent, var(--accent)) 80%, transparent);
}
.nav .count { margin-left: auto; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav button.active .count { color: color-mix(in srgb, var(--tab-accent, var(--accent)) 70%, #fff); }

.sidebar .foot { margin-top: auto; padding: 13px 11px 2px; font-size: 10.5px; color: var(--dim); line-height: 1.65; border-top: 1px solid var(--stroke); }
.sidebar .foot b { color: var(--muted); font-weight: 600; }
.sidebar .foot #foot-stat b { color: var(--c-violet); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 22px;
  border-bottom: 1px solid var(--stroke); background: rgba(10, 10, 16, 0.5); backdrop-filter: blur(9px);
}
.search-wrap { position: relative; flex: 1; max-width: 640px; }
.search-wrap .mag { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; place-items: center; pointer-events: none; }
.search-wrap .mag svg { width: 16px; height: 16px; display: block; }
#globalSearch {
  width: 100%; padding: 11px 15px 11px 42px; border-radius: 12px;
  background: var(--bg-3); border: 1px solid var(--stroke-2); color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; transition: all 0.18s ease;
}
#globalSearch::placeholder { color: var(--dim); }
#globalSearch:focus {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.14), 0 0 22px -6px rgba(168, 85, 247, 0.4);
}
.search-wrap:focus-within .mag { color: var(--accent); }

.health-strip { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.hpill {
  display: flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--stroke); font-size: 11.5px; color: var(--muted);
  white-space: nowrap; transition: all 0.2s ease; backdrop-filter: blur(8px);
}
.hpill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.hpill .dot.live { background: var(--green); box-shadow: 0 0 9px var(--green); animation: blink 2.2s ease-in-out infinite; }
.hpill .dot.empty { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.hpill .dot.connecting { background: var(--c-cyan); box-shadow: 0 0 8px var(--c-cyan); animation: blink 1s ease-in-out infinite; }
.hpill .dot.dead { background: var(--red); box-shadow: 0 0 9px var(--red); }
.hpill .dot.disabled { background: var(--dim); }
.hpill b { color: var(--text); font-weight: 600; }
.hpill:hover { border-color: var(--stroke-2); transform: translateY(-1px); }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.content { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity 0.28s ease; }
.view.active { opacity: 1; pointer-events: auto; animation: rise 0.34s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- graph view ---------- */
#view-graph { overflow: hidden; }
#graph { position: absolute; inset: 0; }
#graph canvas { display: block; }
.graph-overlay {
  position: absolute; top: 16px; left: 16px; z-index: 5; width: 240px;
  background: var(--panel-2); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 16px 16px 14px; backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.graph-overlay::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(160deg, rgba(168,85,247,0.4), transparent 45%, rgba(34,211,238,0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.graph-overlay h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.3px; margin-bottom: 12px; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.legend { display: flex; flex-direction: column; gap: 7px; }
.legend .row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); cursor: default; transition: color 0.15s; }
.legend .row:hover { color: var(--text); }
.legend .row .sw { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 9px currentColor; }
.legend .row .lem { font-size: 13px; line-height: 1; margin-left: -2px; }
.slider-row { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--stroke); }
.slider-row label { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 8px; }
.slider-row label span { color: var(--c-violet); font-weight: 700; font-variant-numeric: tabular-nums; }
.slider-row input[type=range] {
  width: 100%; height: 5px; border-radius: 4px; -webkit-appearance: none; appearance: none; outline: none;
  background: linear-gradient(90deg, var(--c-cyan), var(--c-violet), var(--c-fuchsia));
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 2px solid var(--c-violet); box-shadow: 0 0 10px rgba(168,85,247,0.7);
  transition: transform 0.12s;
}
.slider-row input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }
.slider-row input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; cursor: pointer; background: #fff; border: 2px solid var(--c-violet); box-shadow: 0 0 10px rgba(168,85,247,0.7); }

.gbtn {
  margin-top: 12px; width: 100%; padding: 9px; border-radius: 11px; cursor: pointer; font-family: inherit;
  background: var(--grad-soft); border: 1px solid rgba(168, 85, 247, 0.4); color: var(--text);
  font-size: 12.5px; font-weight: 700; transition: all 0.18s;
}
.gbtn:hover { border-color: rgba(168, 85, 247, 0.75); box-shadow: 0 0 18px -2px rgba(168, 85, 247, 0.5); transform: translateY(-1px); }
.gbtn:active { transform: translateY(0) scale(0.99); }

.zoom-row { display: flex; gap: 6px; margin-top: 11px; }
.zbtn {
  flex: 1; padding: 7px 0; border-radius: 10px; cursor: pointer; font-family: inherit;
  font-size: 16px; font-weight: 700; line-height: 1; color: var(--text);
  background: var(--bg-3); border: 1px solid var(--stroke-2);
  transition: all 0.15s; -webkit-user-select: none; user-select: none;
}
.zbtn:hover { border-color: rgba(168, 85, 247, 0.6); color: #fff; box-shadow: 0 0 14px -2px rgba(168, 85, 247, 0.5); background: rgba(168, 85, 247, 0.1); }
.zbtn:active { transform: translateY(1px) scale(0.97); }

.graph-msg { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; }
.graph-msg .gm-card {
  pointer-events: auto; text-align: center; max-width: 380px; padding: 30px 34px;
  background: var(--panel-2); border: 1px solid var(--stroke-2); border-radius: var(--radius);
  backdrop-filter: blur(18px); box-shadow: var(--shadow); color: var(--muted);
}
.graph-msg .big { font-size: 42px; margin-bottom: 12px; opacity: 0.85; }
.graph-msg .gm-t { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.graph-msg .note { font-size: 12.5px; color: var(--dim); line-height: 1.55; margin-bottom: 14px; word-break: break-word; }
.graph-msg .gbtn { margin-top: 0; }

.node-drawer {
  position: absolute; top: 16px; right: 16px; z-index: 6; width: 348px; max-height: calc(100% - 32px);
  background: var(--panel-2); border: 1px solid var(--stroke-2); border-radius: var(--radius);
  padding: 18px; backdrop-filter: blur(20px); box-shadow: var(--shadow); overflow-y: auto;
  transform: translateX(30px); opacity: 0; pointer-events: none; transition: all 0.28s cubic-bezier(.2,.8,.2,1);
}
.node-drawer.open { transform: none; opacity: 1; pointer-events: auto; }
.node-drawer .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; padding: 4px 10px; border-radius: 999px; font-weight: 700; }
.node-drawer h2 { font-size: 18px; margin: 12px 0 6px; line-height: 1.25; }
.node-drawer .sum { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 14px; white-space: pre-wrap; }
.node-drawer .facts-h { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); margin-bottom: 8px; }
.fact { font-size: 12.5px; color: var(--text); padding: 8px 11px; border-left: 2px solid var(--accent); background: rgba(168, 85, 247, 0.07); border-radius: 0 8px 8px 0; margin-bottom: 7px; transition: background 0.15s; }
.fact:hover { background: rgba(168, 85, 247, 0.13); }
.node-drawer .close { position: absolute; top: 14px; right: 14px; cursor: pointer; color: var(--muted); font-size: 16px; background: none; border: none; transition: color 0.15s; }
.node-drawer .close:hover { color: var(--text); }

/* ---------- scroll views ---------- */
.scroller { position: absolute; inset: 0; overflow-y: auto; padding: 24px 28px 60px; }
.view-head { margin-bottom: 20px; }
.view-head h1 { font-size: 23px; font-weight: 750; letter-spacing: -0.3px; }
.view-head h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.view-head p { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 760px; }

/* search results */
.results { display: flex; flex-direction: column; gap: 9px; max-width: 920px; }
.result {
  position: relative; background: var(--panel); border: 1px solid var(--stroke); border-radius: 13px; padding: 13px 15px;
  display: flex; gap: 13px; align-items: flex-start; cursor: pointer; transition: all 0.16s;
  animation: rise 0.3s ease backwards; overflow: hidden;
}
.result::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0; transition: opacity 0.16s; }
.result:hover { border-color: rgba(168, 85, 247, 0.4); background: var(--panel-2); transform: translateX(3px); box-shadow: 0 8px 26px -18px rgba(168, 85, 247, 0.6); }
.result:hover::before { opacity: 1; }
.result .badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 8px; border-radius: 7px; flex: none; margin-top: 2px; }
.result .body { min-width: 0; flex: 1; }
.result .rtitle { font-weight: 650; font-size: 14px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .snip { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.result .meta { margin-top: 6px; font-size: 11px; color: var(--dim); display: flex; gap: 12px; }
/* per-layer badge colours — each memory layer gets its own brand hue */
.badge.graphiti { background: rgba(168, 85, 247, 0.16); color: #d6b6ff; border: 1px solid rgba(168,85,247,0.35); }
.badge.apollo_os { background: rgba(52, 226, 180, 0.15); color: #7ff0d2; border: 1px solid rgba(52,226,180,0.32); }
.badge.vault { background: rgba(34, 211, 238, 0.15); color: #86e7f6; border: 1px solid rgba(34,211,238,0.32); }
.badge.memory { background: rgba(91, 157, 255, 0.15); color: #a8c8ff; border: 1px solid rgba(91,157,255,0.32); }
.badge.qdrant { background: rgba(217, 70, 239, 0.15); color: #eeaaf7; border: 1px solid rgba(217,70,239,0.32); }

/* kanban */
.board { display: flex; gap: 13px; overflow-x: auto; padding-bottom: 20px; height: 100%; }
.col { flex: none; width: 254px; display: flex; flex-direction: column; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 8px 4px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.col-h .n { margin-left: auto; background: rgba(255, 255, 255, 0.06); color: var(--muted); border-radius: 7px; padding: 1px 8px; font-size: 11px; }
.col-h .bar { width: 4px; height: 15px; border-radius: 3px; box-shadow: 0 0 8px currentColor; }
.col .cards { display: flex; flex-direction: column; gap: 9px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; transition: all 0.16s; }
.card:hover { border-color: rgba(168, 85, 247, 0.4); transform: translateY(-2px); box-shadow: 0 10px 26px -18px rgba(168, 85, 247, 0.55); }
.card .ct { font-weight: 600; font-size: 13px; line-height: 1.4; margin-bottom: 8px; }
.card .cmeta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.card .chip { background: rgba(168, 85, 247, 0.1); color: #cdb0f0; padding: 2px 7px; border-radius: 6px; border: 1px solid rgba(168,85,247,0.2); }
.col-empty { color: var(--dim); font-size: 12px; padding: 14px 10px; border: 1px dashed var(--stroke); border-radius: 11px; text-align: center; }

/* timeline */
.timeline { max-width: 840px; position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--c-cyan), var(--c-violet), var(--c-fuchsia), transparent); }
.tl-item { position: relative; margin-bottom: 18px; animation: rise 0.3s ease backwards; }
.tl-item::before { content: ""; position: absolute; left: -26px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); border: 2px solid var(--bg); }
.tl-item.superseded { opacity: 0.5; }
.tl-item.superseded::before { background: var(--dim); box-shadow: none; }
.tl-card { position: relative; background: var(--panel); border: 1px solid var(--stroke); border-radius: 13px; padding: 14px 16px; transition: all 0.16s; }
.tl-card:hover { border-color: rgba(168, 85, 247, 0.4); box-shadow: 0 10px 26px -18px rgba(168, 85, 247, 0.5); }
.tl-card .q { font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.tl-card .d { color: var(--muted); font-size: 13px; line-height: 1.55; }
.tl-card .tlmeta { margin-top: 9px; display: flex; gap: 12px; font-size: 11px; color: var(--dim); align-items: center; flex-wrap: wrap; }
.tl-card .src { padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.src.apollo_os { background: rgba(52, 226, 180, 0.14); color: #7ff0d2; }
.src.vault { background: rgba(34, 211, 238, 0.14); color: #86e7f6; }
.src.graphiti { background: rgba(168, 85, 247, 0.16); color: #d6b6ff; }

/* rules browser */
.rules-grid { display: grid; grid-template-columns: 344px 1fr; gap: 16px; height: 100%; }
.rules-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.rules-search { position: sticky; top: 0; z-index: 2; }
.rules-search input { width: 100%; padding: 9px 13px; border-radius: 11px; background: var(--bg-3); border: 1px solid var(--stroke-2); color: var(--text); font-family: inherit; font-size: 13px; outline: none; margin-bottom: 4px; transition: all 0.16s; }
.rules-search input:focus { border-color: rgba(168, 85, 247, 0.55); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12); }
.rule-item { padding: 10px 12px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; transition: all 0.15s; }
.rule-item:hover { background: rgba(168, 85, 247, 0.06); }
.rule-item.active { background: rgba(168, 85, 247, 0.13); border-color: rgba(168, 85, 247, 0.4); box-shadow: inset 0 0 0 1px rgba(168,85,247,0.1); }
.rule-item .rn { font-size: 13px; font-weight: 600; line-height: 1.35; margin-bottom: 3px; }
.rule-item .rf { font-size: 10.5px; color: var(--dim); font-family: ui-monospace, "SF Mono", Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-item .kbadge { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 6px; border-radius: 5px; margin-right: 6px; }
.kbadge.rule { background: rgba(217, 70, 239, 0.16); color: #eeaaf7; }
.kbadge.memory { background: rgba(34, 211, 238, 0.14); color: #86e7f6; }
.rule-view { background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 22px 26px; overflow-y: auto; }
.rule-view .path { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--accent); margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--stroke); word-break: break-all; }
.md { font-size: 13.5px; line-height: 1.7; color: var(--text); }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; line-height: 1.3; }
.md h1 { font-size: 19px; } .md h2 { font-size: 16px; } .md h3 { font-size: 14px; color: var(--text); }
.md p { margin: 8px 0; color: #cbcbd6; }
.md code { background: rgba(168, 85, 247, 0.12); padding: 1px 6px; border-radius: 5px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #d6b6ff; }
.md a, .md .wl { color: var(--c-cyan); text-decoration: none; }
.md ul, .md ol { margin: 8px 0 8px 20px; color: #cbcbd6; }
.md li { margin: 4px 0; }
.md .wl { background: rgba(34, 211, 238, 0.1); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.md strong { color: #fff; }
.md hr { border: none; border-top: 1px solid var(--stroke); margin: 16px 0; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state .big { font-size: 40px; margin-bottom: 12px; opacity: 0.8; }
.empty-state .note { font-size: 12.5px; color: var(--dim); margin-top: 8px; }
.loading { color: var(--muted); font-size: 13px; padding: 30px; display: flex; align-items: center; gap: 10px; }
.spin { width: 15px; height: 15px; border: 2px solid var(--stroke-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stat-inline { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.stat-inline b { color: var(--c-violet); font-variant-numeric: tabular-nums; }

/* ---------- skeleton loaders (premium load state) ---------- */
.sk-shimmer {
  position: relative; overflow: hidden; background: rgba(255,255,255,0.03);
  border-radius: 8px;
}
.sk-shimmer::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(168,85,247,0.14) 45%, rgba(34,211,238,0.12) 55%, transparent);
  animation: sk-slide 1.25s ease-in-out infinite;
}
@keyframes sk-slide { to { transform: translateX(100%); } }
.sk-board { display: flex; gap: 13px; }
.sk-col { flex: none; width: 254px; display: flex; flex-direction: column; gap: 9px; }
.sk-h { height: 16px; width: 60%; margin: 6px 0 8px; }
.sk-card { height: 62px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--panel); }
.sk-line { height: 12px; margin: 7px 0; }
.sk-tl { max-width: 840px; }
.sk-tl .sk-card { height: 84px; margin-bottom: 16px; }
.sk-rules { display: flex; flex-direction: column; gap: 7px; }
.sk-rule { height: 46px; border-radius: 11px; }
