/* Central Brain dashboard — tamna tema, staklene plohe, neonski akcenti. Bez vanjskih fontova (CSP). */
:root {
  --bg: #060a13;
  --bg2: #0b1222;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.08);
  --line: rgba(148, 163, 184, 0.16);
  --text: #e6edf7;
  --muted: #8b98ad;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --pink: #f472b6;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
#bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(124, 58, 237, 0.20), transparent 60%),
    radial-gradient(800px 600px at 100% 10%, rgba(34, 211, 238, 0.14), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(52, 211, 153, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--red); min-height: 1.2em; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
a { color: var(--cyan); }

.glass {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow);
}

/* logo */
.logo-mark { width: 54px; height: 54px; border-radius: 50%; position: relative; margin: 0 auto 10px;
  background: radial-gradient(circle at 50% 50%, #e0fbff 0, var(--cyan) 35%, #7c3aed 75%, transparent 76%);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.55), 0 0 60px rgba(124, 58, 237, 0.35);
  animation: breathe 4s ease-in-out infinite; }
.logo-mark span { position: absolute; inset: -8px; border-radius: 50%; border: 1px solid rgba(34, 211, 238, 0.35);
  animation: spin 12s linear infinite; border-top-color: transparent; }
.logo-mark.sm { width: 26px; height: 26px; margin: 0; }
.logo-mark.sm span { inset: -5px; }
@keyframes breathe { 50% { transform: scale(1.06); filter: brightness(1.15); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* prijava */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 32px 28px; text-align: center; display: grid; gap: 12px; }
.login-card label { text-align: left; display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select, textarea {
  background: rgba(2, 6, 23, 0.55); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }

.btn { border: 1px solid var(--line); background: var(--glass-2); color: var(--text); border-radius: 10px;
  padding: 9px 14px; font: inherit; cursor: pointer; transition: transform .12s, background .2s, border-color .2s; }
.btn:hover { border-color: rgba(34, 211, 238, 0.5); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #0891b2, #7c3aed); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.good { background: rgba(52, 211, 153, 0.15); border-color: rgba(52, 211, 153, 0.4); color: #a7f3d0; }
.btn.bad { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

/* raspored */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; gap: 16px; padding: 16px; }
.sidebar { padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px;
  height: calc(100vh - 32px); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; font-size: 15px; }
#nav { display: grid; gap: 4px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted);
  text-decoration: none; transition: background .2s, color .2s; position: relative; }
#nav a:hover { background: var(--glass-2); color: var(--text); }
#nav a.active { color: var(--text); background: linear-gradient(90deg, rgba(34, 211, 238, 0.16), rgba(124, 58, 237, 0.06)); }
#nav a.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--cyan), var(--violet)); }
#nav svg { width: 18px; height: 18px; flex: none; }
#nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px 4px 0; }
.topbar h2 { font-size: 22px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.warn { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.dot.bad { background: var(--red); box-shadow: 0 0 10px var(--red); }
.dot.live { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.page { display: grid; gap: 16px; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* kartice i mreže */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.live-grid { grid-template-columns: minmax(0, 1fr) 360px; }
.card { padding: 18px; }
.card h3 { font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow, rgba(34, 211, 238, 0.22)), transparent 70%); }
.kpi.v { --glow: rgba(167, 139, 250, 0.25); } .kpi.g { --glow: rgba(52, 211, 153, 0.22); } .kpi.a { --glow: rgba(251, 191, 36, 0.22); }

/* mozak */
.brain-card { padding: 0; position: relative; overflow: hidden; min-height: 520px; }
#brain { width: 100%; height: 520px; display: block; }
.brain-legend { position: absolute; left: 16px; bottom: 14px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.brain-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.brain-title { position: absolute; left: 18px; top: 14px; }
.brain-title h3 { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 16px; margin: 0; }
.brain-status { position: absolute; right: 16px; top: 14px; }

/* tok događaja */
.feed { padding: 16px; display: flex; flex-direction: column; max-height: 520px; }
.feed-list { overflow: auto; display: grid; gap: 8px; padding-right: 4px; }
.ev { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(2, 6, 23, 0.35);
  border: 1px solid transparent; animation: slidein .45s ease; }
.ev.new { border-color: rgba(34, 211, 238, 0.45); box-shadow: 0 0 20px rgba(34, 211, 238, 0.12); }
.ev .bullet { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.ev .t { font-size: 13px; }
.ev .m { font-size: 11px; color: var(--muted); }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }

/* ciljevi */
.goal { padding: 16px 18px; display: grid; gap: 10px; }
.goal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.goal-title { font-weight: 600; }
.bar { height: 8px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 1s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 12px rgba(34, 211, 238, 0.5); }
.bar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--amber); border-radius: 2px; }
.goal-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.goal-meta b { color: var(--text); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--line); background: var(--glass-2); color: var(--muted); white-space: nowrap; }
.badge.cyan { color: #a5f3fc; border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .1); }
.badge.violet { color: #ddd6fe; border-color: rgba(167, 139, 250, .35); background: rgba(167, 139, 250, .1); }
.badge.green { color: #a7f3d0; border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .1); }
.badge.amber { color: #fde68a; border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .1); }
.badge.red { color: #fecaca; border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .1); }

/* pitaj */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 60vh; }
.chat-log { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.msg { max-width: 860px; padding: 14px 16px; border-radius: 14px; white-space: pre-wrap; animation: rise .3s ease; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, rgba(8, 145, 178, .35), rgba(124, 58, 237, .3)); }
.msg.bot { align-self: flex-start; background: var(--glass); border: 1px solid var(--line); }
.msg .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.msg .src { margin-top: 10px; font-size: 12px; color: var(--muted); white-space: normal; }
.chat-form { display: flex; gap: 10px; position: sticky; bottom: 16px; }
.chat-form input { flex: 1; padding: 14px 16px; border-radius: 14px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.thinking { display: inline-flex; gap: 4px; } .thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan);
  animation: bounce 1s infinite; } .thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-5px); opacity: .5; } }

/* tablice i liste */
.list { display: grid; gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px;
  background: rgba(2, 6, 23, 0.35); border: 1px solid var(--line); flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 220px; }
.row .actions { display: flex; gap: 8px; }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #cbd5e1; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.gauge { display: grid; gap: 6px; }
.gauge .bar > i { background: linear-gradient(90deg, var(--green), var(--cyan)); }
.gauge.warn .bar > i { background: linear-gradient(90deg, var(--amber), var(--red)); }

.toast { position: fixed; right: 20px; bottom: 20px; padding: 12px 16px; border-radius: 12px; background: #0f172a; border: 1px solid var(--line);
  box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: none; max-width: 420px; }
.toast.show { opacity: 1; transform: none; }
.toast.err { border-color: rgba(248, 113, 113, .5); }

@media (max-width: 1100px) { .live-grid { grid-template-columns: 1fr; } .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; padding: 10px; }
  .sidebar { position: static; height: auto; }
  #nav { grid-template-columns: repeat(4, 1fr); } #nav a span.lbl { display: none; } #nav a { justify-content: center; }
  .side-foot { display: none; } .cols-2 { grid-template-columns: 1fr; } #brain { height: 380px; } .brain-card { min-height: 380px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
