:root {
  --bg: #0a0708;
  --bg-soft: #0f0b0d;
  --surface: #171012;
  --surface-2: #1f161a;
  --surface-3: #2a1d22;
  --border: #33232a;
  --border-soft: #241a1e;
  --text: #f3eef0;
  --text-dim: #b39aa3;
  --text-faint: #7a6068;
  --accent: #ff2b4e;
  --accent-2: #ff5470;
  --accent-deep: #c0102f;
  --accent-soft: #2e1118;
  --good: #35d07f;
  --warn: #f5a623;
  --crit: #ff3b5c;
  --holo: linear-gradient(115deg, #ff2b4e 0%, #ff7849 22%, #ffd23f 38%, #c724ff 60%, #2bd4ff 80%, #ff2b4e 100%);
  --shadow: 0 12px 40px rgba(0,0,0,.5);
  --glow: 0 0 24px rgba(255,43,78,.45);
  --radius: 16px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* animated aurora background */
body::before {
  content: ""; position: fixed; inset: -20%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40% 40% at 80% 10%, rgba(255,43,78,.18), transparent 60%),
    radial-gradient(35% 35% at 12% 20%, rgba(199,36,255,.10), transparent 60%),
    radial-gradient(45% 45% at 60% 90%, rgba(43,212,255,.07), transparent 60%);
  animation: aurora 22s ease-in-out infinite alternate;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 80%);
}
@keyframes aurora { 0% { transform: translate(0,0) rotate(0deg); } 100% { transform: translate(3%, 2%) rotate(4deg); } }
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-deep); }

/* holographic helpers */
.holo {
  background: var(--holo); background-size: 300% 300%; animation: holo-shift 8s linear infinite;
}
@keyframes holo-shift { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.holo-text {
  background: var(--holo); background-size: 300% 300%; -webkit-background-clip: text;
  background-clip: text; color: transparent; animation: holo-shift 8s linear infinite;
}

/* SVG icons */
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- app shell ---------- */
.app-shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(23,16,18,.9), rgba(10,7,8,.9));
  border-right: 1px solid var(--border-soft); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 3px; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 13px; padding: 4px 10px 20px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  position: relative; box-shadow: var(--glow); overflow: hidden;
}
.brand .logo svg { width: 26px; height: 26px; position: relative; z-index: 1; }
.brand .logo::before { content: ""; position: absolute; inset: 0; background: var(--holo);
  background-size: 300% 300%; animation: holo-shift 6s linear infinite; opacity: .9; }
.brand b { font-weight: 750; letter-spacing: .3px; display: block; font-size: 16px; }
.brand small { color: var(--text-faint); font-size: 11px; letter-spacing: .4px; }
.nav-section { color: var(--text-faint); font-size: 10px; text-transform: uppercase;
  letter-spacing: 1.4px; padding: 16px 12px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 13px; padding: 10px 12px; border-radius: 11px;
  color: var(--text-dim); cursor: pointer; font-weight: 500; position: relative; user-select: none;
  transition: background .2s, color .2s, transform .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(3px); }
.nav-item.active { background: linear-gradient(90deg, var(--accent-soft), transparent); color: #fff; }
.nav-item.active svg.ic { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(255,43,78,.7)); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 3px; background: var(--holo); background-size: 100% 300%;
  animation: holo-shift 6s linear infinite; box-shadow: 0 0 10px var(--accent); }
.nav-item .pill-badge { margin-left: auto; background: var(--accent); color: #fff;
  font-size: 10px; padding: 1px 7px; border-radius: 999px; font-weight: 700; box-shadow: var(--glow); }
.sidebar .foot { margin-top: auto; padding: 12px; color: var(--text-faint); font-size: 11px; }

/* ---------- topbar ---------- */
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 16px 30px; background: rgba(10,7,8,.72); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -.3px; }
.topbar .sub { color: var(--text-faint); font-size: 12.5px; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim);
  transition: border-color .2s; }
.pill:hover { border-color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.dot.good { background: var(--good); box-shadow: 0 0 0 3px rgba(53,208,127,.18); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245,166,35,.18); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 4px rgba(255,59,92,.22); animation: pulse 1.3s infinite; }
@keyframes pulse { 50% { opacity: .4; transform: scale(1.25); } }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  width: 38px; height: 38px; border-radius: 11px; cursor: pointer; display: grid; place-items: center;
  transition: all .2s; }
.icon-btn:hover { color: #fff; border-color: var(--accent); box-shadow: var(--glow); transform: translateY(-1px); }

/* global search */
.search-box { position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 0 12px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,43,78,.12); }
.search-box input { background: none; border: none; box-shadow: none; padding: 9px 0; width: 220px; }
.search-results { position: absolute; top: calc(100% + 8px); right: 0; width: 380px; max-height: 420px;
  overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px; z-index: 40; }
.search-results .sr { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; cursor: pointer; }
.search-results .sr:hover { background: var(--surface-2); }
.search-results .sr .tag { font-size: 10px; color: var(--accent); background: var(--accent-soft);
  padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.search-results .sr .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view-wrap { padding: 28px 30px 70px; max-width: 1320px; }
.view { display: none; }
.view.active { display: block; animation: viewIn .4s cubic-bezier(.2,.7,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
@media (max-width: 1100px) { .col-3,.col-4,.col-5,.col-7 { grid-column: span 6; } .col-8 { grid-column: span 12; } }
@media (max-width: 720px) { .grid > * { grid-column: span 12 !important; } .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .nav-section, .sidebar .foot { display: none; } }

.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); position: relative; transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); padding: 1px;
  background: var(--holo); background-size: 300% 300%; opacity: 0; transition: opacity .3s;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; animation: holo-shift 8s linear infinite;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 0 0 1px rgba(255,43,78,.1); }
.card:hover::after { opacity: .55; }
.card.pad-lg { padding: 26px 28px; }
.card h2 { margin: 0 0 16px; font-size: 12px; text-transform: uppercase; letter-spacing: 1.3px;
  color: var(--text-faint); font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card h2 svg.ic { width: 15px; height: 15px; stroke: var(--accent); }
.card h2 .count { margin-left: auto; color: var(--text-dim); font-size: 12px; background: var(--surface-3);
  padding: 2px 9px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.section-title { font-size: 23px; font-weight: 750; margin: 0 0 4px; letter-spacing: -.4px; }
.section-desc { color: var(--text-faint); margin: 0 0 22px; }

/* gauges */
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring { --val: 0; --c: var(--accent); width: 108px; height: 108px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--val) * 1%), var(--surface-2) 0);
  display: grid; place-items: center; transition: background .7s cubic-bezier(.2,.7,.2,1); position: relative;
  filter: drop-shadow(0 0 10px rgba(255,43,78,.25)); }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--bg-soft); }
.ring b { position: relative; font-size: 21px; font-weight: 750; }
.gauge span { color: var(--text-dim); font-size: 12.5px; }

.stat-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.stat-row:last-child { border-bottom: none; }
.stat-row .k { color: var(--text-dim); } .stat-row .v { font-variant-numeric: tabular-nums; font-weight: 650; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .big { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.kpi .lbl { color: var(--text-faint); font-size: 12.5px; }

canvas { width: 100%; display: block; }
.legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* lists */
.list { display: flex; flex-direction: column; gap: 9px; }
.list.scroll { max-height: 420px; overflow: auto; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 12px; transition: border-color .2s, transform .15s; }
.item:hover { border-color: var(--border); transform: translateX(2px); }
.item .badge { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.badge.INFO { background: rgba(255,43,78,.14); color: var(--accent-2); }
.badge.WARNING { background: rgba(245,166,35,.16); color: var(--warn); }
.badge.CRITICAL { background: rgba(255,59,92,.18); color: var(--crit); }
.badge.loaded { background: rgba(53,208,127,.16); color: var(--good); }
.badge.quarantined, .badge.disabled { background: rgba(255,59,92,.18); color: var(--crit); }
.item .grow { flex: 1; min-width: 0; }
.item .grow .t { font-weight: 600; } .item .grow .t.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .grow .s { color: var(--text-faint); font-size: 12.5px; }
.muted { color: var(--text-faint); text-align: center; padding: 24px; font-size: 13px; }

/* forms */
.check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border); cursor: pointer;
  flex: none; display: grid; place-items: center; color: var(--text-faint); font-size: 12px; transition: all .2s; }
.check:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px rgba(255,43,78,.3); }
.check.done { background: var(--good); border-color: var(--good); color: #04210f; }
.prio1 { border-left: 3px solid var(--crit); } .prio2 { border-left: 3px solid var(--warn); } .prio3 { border-left: 3px solid var(--text-faint); }
.add-row { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
input, select, textarea { background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 13px; font: inherit; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,43,78,.12); }
input.grow { flex: 1; min-width: 120px; }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; border: none;
  border-radius: 10px; padding: 10px 18px; font-weight: 650; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .2s; }
button.primary:hover { transform: translateY(-1px); box-shadow: var(--glow); }
button.primary::after { content: ""; position: absolute; inset: 0; background: var(--holo); background-size: 300% 300%;
  opacity: 0; transition: opacity .3s; mix-blend-mode: overlay; animation: holo-shift 6s linear infinite; }
button.primary:hover::after { opacity: .6; }
button.ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 10px; padding: 9px 14px; cursor: pointer; transition: all .2s; }
button.ghost:hover { color: #fff; border-color: var(--accent); }
.chip { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; transition: all .2s; }
.chip:hover { border-color: var(--accent); }
.chip.done { border-color: var(--good); color: var(--good); box-shadow: 0 0 10px rgba(53,208,127,.2); }
.chip .streak { color: var(--text-faint); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chat-log { display: flex; flex-direction: column; gap: 9px; min-height: 90px; max-height: 460px; overflow: auto; margin-bottom: 14px; }
.bubble { padding: 10px 14px; border-radius: 13px; max-width: 80%; white-space: pre-wrap; font-size: 13.5px; animation: viewIn .3s ease; }
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; }
.bubble.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-soft); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.66); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(4px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
  width: min(420px, 92vw); box-shadow: var(--shadow); position: relative; }
.modal h3 { margin: 0 0 6px; } .modal p { color: var(--text-dim); margin: 0 0 16px; }
.hidden { display: none !important; }
.setup-note { background: rgba(255,43,78,.06); border: 1px solid rgba(255,43,78,.22); color: #f0b9c4;
  border-radius: 12px; padding: 12px 16px; font-size: 13px; margin-bottom: 18px; }
.setup-note code { background: rgba(0,0,0,.35); padding: 1px 6px; border-radius: 5px; }
.grid-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700;
  background: var(--surface-3); color: var(--accent); font-size: 14px; }


/* brain graph */
/* ===================== GEHIRN (Wissensgraph) ===================== */
#view-brain.active { display: flex; flex-direction: column; }
.brain-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.brain-toolbar .spacer { flex: 1 1 auto; }
.brain-search-box {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 7px 12px; min-width: 220px;
}
.brain-search-box input { background: none; border: 0; outline: 0; color: var(--text); font-size: 13.5px; width: 180px; }
.brain-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brain-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 999px; padding: 5px 10px; font-size: 12px; line-height: 1; transition: .15s;
}
.brain-chip:hover { border-color: var(--accent-deep); color: var(--text); }
.brain-chip.on { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.brain-chip:not(.on) { opacity: .45; }
.brain-chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.brain-chip em { font-style: normal; color: var(--text-faint); font-size: 11px; }
.brain-stats { color: var(--text-faint); font-size: 12px; white-space: nowrap; }

.brain-stage {
  position: relative; flex: 1 1 auto; min-height: 480px; height: calc(100vh - 230px);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(60% 60% at 50% 40%, rgba(255,43,78,.05), transparent 70%),
    var(--bg-soft);
}
#brain-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; display: block; touch-action: none; }
#brain-canvas:active { cursor: grabbing; }

.brain-legend {
  position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px;
  max-width: 60%; padding: 9px 12px; background: rgba(15,11,13,.78); backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft); border-radius: 12px; font-size: 11.5px; color: var(--text-dim);
  pointer-events: none;
}
.brain-legend span { display: inline-flex; align-items: center; gap: 6px; }
.brain-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.brain-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 30px; color: var(--text-faint); font-size: 14px; pointer-events: none;
}
.brain-empty b { color: var(--accent-2); }

.brain-panel {
  position: absolute; top: 12px; right: 12px; width: 320px; max-width: calc(100% - 24px);
  max-height: calc(100% - 24px); overflow: auto; padding: 16px 16px 18px;
  background: rgba(23,16,18,.92); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  animation: viewIn .25s cubic-bezier(.2,.7,.2,1);
}
.brain-panel-close {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  cursor: pointer; font-size: 16px; line-height: 1; }
.brain-panel-close:hover { color: var(--text); border-color: var(--accent-deep); }
.brain-panel-type { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); margin-bottom: 4px; }
.brain-panel-type .dot { width: 9px; height: 9px; border-radius: 50%; }
.brain-panel h3 { margin: 2px 0 10px; font-size: 16px; line-height: 1.35; padding-right: 26px; }
.brain-panel-text { font-size: 13px; line-height: 1.6; color: var(--text-dim); margin: 0 0 12px;
  white-space: pre-wrap; max-height: 200px; overflow: auto; }
.brain-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.brain-tag { font-size: 11px; color: var(--text-faint); background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 6px; padding: 2px 7px; }
.brain-open { display: inline-block; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.brain-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint);
  margin: 12px 0 7px; }
.brain-neighbors { display: flex; flex-direction: column; gap: 5px; }
.brain-nchip { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 9px;
  padding: 6px 9px; color: var(--text); font-size: 12.5px; transition: .15s; }
.brain-nchip:hover { border-color: var(--accent-deep); background: var(--surface-2); }
.brain-nchip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.brain-nchip span.t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-nchip em { font-style: normal; color: var(--text-faint); font-size: 10.5px; flex: none; }

.brain-hint { margin-top: 8px; color: var(--text-faint); font-size: 11.5px; text-align: center; }
@media (max-width: 720px) { .brain-panel { width: calc(100% - 24px); } .brain-legend { max-width: calc(100% - 24px); } }
