/* Shared Neura tokens + base layout */

:root {
  --bg: #030305;
  --bg-raised: #0a0b0f;
  --bg-panel: #080910;
  --line: #1d1f26;
  --line-2: #272932;
  --ink: #e9eaec;
  --ink-dim: #a8abb4;
  --ink-mute: #6b6f79;
  --ink-faint: #3a3d46;

  /* Kind colors — shared across all variations */
  --c-core: #e9eaec;        /* near-white */
  --c-agent: #a78bfa;       /* violet */
  --c-skill: #f4b860;       /* amber */
  --c-workflow: #5eead4;    /* teal */
  --c-error: #f87171;
  --c-warn: #fbbf24;
  --c-off: #6b6f79;
  --c-ok: #5eead4;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

.neura-app {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

/* Header */
.na-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.na-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.na-logo {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--ink);
}
.na-sub {
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.na-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-transform: lowercase;
}
.na-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.na-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 7px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 12px;
}
.na-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font-family: inherit;
  font-size: inherit;
  min-width: 0;
}
.na-search input::placeholder { color: var(--ink-mute); }
.na-kbd {
  font-size: 10px;
  color: var(--ink-mute);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.na-actions { display: flex; gap: 8px; align-items: center; }
.na-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--ink-dim);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}
.na-btn:hover { color: var(--ink); border-color: #3a3d46; }
.na-btn.primary { background: var(--ink); color: #08080b; border-color: var(--ink); }
.na-btn.primary:hover { background: #fff; }

/* Body = left nav + canvas + right panel */
.na-body {
  display: grid;
  grid-template-columns: 232px 1fr 340px;
  overflow: hidden;
}

/* LEFT NAV ------ filters + list */
.na-left {
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto;
  padding: 18px 0;
}
.na-section {
  padding: 0 18px 6px;
}
.na-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.na-filters { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; }
.na-filter {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  color: var(--ink-dim);
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 12.5px;
}
.na-filter:hover { color: var(--ink); background: rgba(255,255,255,0.02); }
.na-filter.active { color: var(--ink); border-left-color: currentColor; background: rgba(255,255,255,0.03); }
.na-filter .sw { width: 8px; height: 8px; border-radius: 2px; }
.na-filter .count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }

.na-list { display: flex; flex-direction: column; }
.na-list-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  cursor: pointer;
  color: var(--ink-dim);
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
}
.na-list-item:hover { color: var(--ink); background: rgba(255,255,255,0.02); }
.na-list-item.active { color: var(--ink); border-left-color: currentColor; background: rgba(255,255,255,0.04); }
.na-list-item .dot { width: 6px; height: 6px; border-radius: 50%; }
.na-list-item .meta { font-size: 10.5px; color: var(--ink-mute); }

/* CANVAS ------- */
.na-canvas {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(88,28,135,0.09) 0%, transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(59,130,246,0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(167,139,250,0.04) 0%, transparent 35%),
    radial-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    var(--bg);
  background-size: 100% 100%, 100% 100%, 100% 100%, 36px 36px, 100% 100%;
}
.na-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ── Neuron pulse animations ────────────────────────────────────── */
@keyframes np-core {
  0%, 100% { filter: drop-shadow(0 0 7px rgba(233,234,236,0.45)) drop-shadow(0 0 2px rgba(233,234,236,0.7)); }
  50%       { filter: drop-shadow(0 0 22px rgba(233,234,236,0.85)) drop-shadow(0 0 5px rgba(233,234,236,1)); }
}
@keyframes np-agent {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(167,139,250,0.4)) drop-shadow(0 0 2px rgba(167,139,250,0.65)); }
  50%       { filter: drop-shadow(0 0 18px rgba(167,139,250,0.82)) drop-shadow(0 0 4px rgba(167,139,250,1)); }
}
@keyframes np-skill {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(244,184,96,0.3)) drop-shadow(0 0 1px rgba(244,184,96,0.55)); }
  50%       { filter: drop-shadow(0 0 10px rgba(244,184,96,0.68)) drop-shadow(0 0 3px rgba(244,184,96,0.9)); }
}
@keyframes np-workflow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(94,234,212,0.35)); }
  50%       { filter: drop-shadow(0 0 12px rgba(94,234,212,0.72)); }
}

.np-core     { animation: np-core     4s ease-in-out infinite; }
.np-agent    { animation: np-agent    3.2s ease-in-out infinite; }
.np-skill    { animation: np-skill    2.6s ease-in-out infinite; }
.np-workflow { animation: np-workflow 3.8s ease-in-out infinite; }

/* dim sobrepõe via opacity, o filter-glow continua sutil — neurônios distantes */
.node.dim { opacity: 0.15; }

.na-overlay {
  position: absolute;
  top: 16px; left: 16px;
  display: flex;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.na-overlay button {
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.na-overlay button.active { background: rgba(255,255,255,0.06); color: var(--ink); }
.na-overlay button:hover:not(.active) { color: var(--ink-dim); }

.na-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  background: rgba(8,8,11,0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
}
.na-legend .it { display: inline-flex; align-items: center; gap: 6px; }
.na-legend .it .sw { width: 9px; height: 9px; border-radius: 50%; }

.na-zoom {
  position: absolute;
  bottom: 16px; right: 16px;
  display: flex;
  gap: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
}
.na-zoom button {
  width: 26px; height: 26px;
  border: 0; background: transparent;
  color: var(--ink-mute);
  border-radius: 5px;
  cursor: pointer;
  font: 13px var(--font-mono);
}
.na-zoom button:hover { background: rgba(255,255,255,0.05); color: var(--ink); }

/* RIGHT PANEL ---- inspector */
.na-right {
  border-left: 1px solid var(--line);
  background: var(--bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.na-insp-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.na-insp-kind {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.na-insp-kind .dot { width: 7px; height: 7px; border-radius: 50%; }
.na-insp-name {
  font-size: 20px;
  font-weight: 500;
  margin: 6px 0 4px;
  letter-spacing: -0.01em;
}
.na-insp-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  word-break: break-all;
}
.na-insp-body {
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.na-insp-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.na-insp-desc { color: var(--ink-dim); font-size: 13px; line-height: 1.55; }
.na-kv { display: grid; grid-template-columns: 100px 1fr; gap: 6px 14px; font-size: 12px; }
.na-kv dt { color: var(--ink-mute); font-family: var(--font-mono); font-size: 11px; }
.na-kv dd { color: var(--ink-dim); margin: 0; font-family: var(--font-mono); font-size: 11.5px; word-break: break-all; }

.na-code {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-dim);
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}
.na-code .k { color: var(--c-agent); }
.na-code .s { color: var(--c-skill); }
.na-code .c { color: var(--ink-mute); }

.na-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.na-chip-mini {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink-dim);
}

.na-insp-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
}
.na-insp-foot .na-btn { flex: 1; justify-content: center; }

/* Empty state for right panel */
.na-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-mute);
}
.na-empty .glyph {
  font-family: var(--font-mono);
  font-size: 40px;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

/* Node label common */
.n-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  fill: var(--ink-dim);
  pointer-events: none;
  text-anchor: middle;
}
.n-label.dim { fill: var(--ink-mute); }
.n-label.strong { fill: var(--ink); }

/* Edge defaults */
.e { stroke: var(--ink-faint); stroke-width: 1; fill: none; opacity: 0.55; }
.e.dim { opacity: 0.12; }
.e.hi { opacity: 1; stroke: var(--ink); stroke-width: 1.2; }

/* Card nodes (V3) */
.n-card-body {
  fill: var(--bg-raised);
  stroke: var(--line-2);
  stroke-width: 1;
}
.n-card-body.hi { stroke: var(--ink); }
.n-card-body.dim { opacity: 0.25; }

/* Hover/click states apply via class on group */
.node { cursor: pointer; transition: opacity 0.2s; }
.node.hi .n-label { fill: var(--ink); }

/* ── Skill inspector layout ─────────────────────────────────────── */
.na-skill-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.na-skill-meta-bar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.na-skill-editor-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px 18px 0;
  gap: 5px;
}
.na-skill-editor-section .na-skill-editor {
  flex: 1;
  min-height: 0;
  max-height: none;
  resize: none;
}

.skill-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.skill-badges { display: flex; gap: 6px; align-items: center; }
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 4px;
}
.badge.warn { color: var(--c-warn); background: rgba(251,191,36,0.08); }
.badge.ok   { color: var(--c-ok);   background: rgba(94,234,212,0.08); }
.badge.err  { color: var(--c-error);background: rgba(248,113,113,0.08); }

.na-skill-editor {
  width: 100%;
  flex: 1;
  min-height: 180px;
  max-height: 340px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-dim);
  line-height: 1.65;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
}
.na-skill-editor:focus {
  border-color: rgba(167,139,250,0.4);
  color: var(--ink);
}
.na-skill-editor::placeholder { color: var(--ink-faint); }

.skill-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-mute);
  text-align: right;
}

.insp-loading {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
  padding: 8px 0;
  animation: blink 1.2s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Inspector tabs (Info / Personalidade) ─────────────────────── */
.na-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  flex-shrink: 0;
  background: var(--bg);
}
.na-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.na-tab:hover { color: var(--ink-dim); }
.na-tab.active { color: var(--ink); border-bottom-color: var(--c-agent); }
.na-tab-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Personality hint bar ───────────────────────────────────────── */
.na-personality-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  background: var(--bg-raised);
  flex-shrink: 0;
}
.na-personality-hint-icon {
  color: var(--c-agent);
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Personality editor (herda .na-skill-editor + override) ─────── */
.na-personality-editor {
  min-height: 220px;
}

/* ── Right panel scroll fix ─────────────────────────────────────── */
.na-insp-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 14px 18px;
  flex: 1;
  min-height: 0;
}
.na-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Edge active glow ───────────────────────────────────────────── */
.e.hi { opacity: 1; stroke: rgba(167,139,250,0.6); stroke-width: 1.4; filter: drop-shadow(0 0 3px rgba(167,139,250,0.4)); }

/* ── Node float animations ──────────────────────────────────────── */
@keyframes float-a { 0%,100%{transform:translate(0,0)} 33%{transform:translate(2px,-3px)} 66%{transform:translate(-2px,2px)} }
@keyframes float-b { 0%,100%{transform:translate(0,0)} 33%{transform:translate(-3px,1.5px)} 66%{transform:translate(1.5px,-2.5px)} }
@keyframes float-c { 0%,100%{transform:translate(0,0)} 33%{transform:translate(1px,-3.5px)} 66%{transform:translate(2.5px,1px)} }
@keyframes float-d { 0%,100%{transform:translate(0,0)} 33%{transform:translate(-2px,2.5px)} 66%{transform:translate(3px,-1px)} }
@keyframes float-e { 0%,100%{transform:translate(0,0)} 33%{transform:translate(2.5px,2px)} 66%{transform:translate(-2px,-2px)} }
@keyframes float-f { 0%,100%{transform:translate(0,0)} 33%{transform:translate(-2px,-3px)} 66%{transform:translate(1.5px,3px)} }
.float-0 { animation: float-a 6s   ease-in-out infinite; }
.float-1 { animation: float-b 7.2s ease-in-out infinite; }
.float-2 { animation: float-c 5.5s ease-in-out infinite; }
.float-3 { animation: float-d 8s   ease-in-out infinite; }
.float-4 { animation: float-e 6.8s ease-in-out infinite; }
.float-5 { animation: float-f 7.5s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════════
   Chat N8n  (.nc-*)
═══════════════════════════════════════════════════════════════════ */

/* Overlay backdrop */
.nc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 5, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: nc-fade-in 0.18s ease;
}
@keyframes nc-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Main panel */
.nc-panel {
  width: min(780px, 95vw);
  height: min(84vh, 740px);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 32px 96px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(167, 139, 250, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: nc-slide-in 0.2s cubic-bezier(.22,.68,0,1.2);
}
@keyframes nc-slide-in { from { transform: translateY(16px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* Panel header */
.nc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
  flex-shrink: 0;
}
.nc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nc-logo {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--c-agent);
}
.nc-session {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}
.nc-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nc-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Icon buttons */
.nc-icon-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink-mute);
  cursor: pointer;
  transition: 0.15s;
  flex-shrink: 0;
}
.nc-icon-btn:hover {
  background: var(--bg-raised);
  border-color: var(--line);
  color: var(--ink);
}
.nc-close-btn:hover { color: var(--c-error); border-color: rgba(248,113,113,0.4); }

/* Config panel */
.nc-cfg {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}
.nc-cfg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) { .nc-cfg-grid { grid-template-columns: 1fr; } }
.nc-cfg-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nc-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.nc-input {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.nc-input:focus {
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.08);
}
.nc-cfg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nc-session-code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  word-break: break-all;
}

/* Messages area */
.nc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.nc-messages::-webkit-scrollbar { width: 3px; }
.nc-messages::-webkit-scrollbar-track { background: transparent; }
.nc-messages::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

/* Empty state */
.nc-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  font-size: 13px;
  gap: 10px;
  padding: 60px 24px;
  text-align: center;
  white-space: pre-line;
  line-height: 1.65;
}
.nc-empty-glyph {
  font-size: 36px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
}

/* Message bubbles */
.nc-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 80%;
}
.nc-msg--user    { align-self: flex-end;   align-items: flex-end; }
.nc-msg--assistant { align-self: flex-start; align-items: flex-start; }

.nc-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}
.nc-msg--user .nc-msg-bubble {
  background: rgba(167, 139, 250, 0.13);
  border: 1px solid rgba(167, 139, 250, 0.22);
  color: var(--ink);
  border-bottom-right-radius: 3px;
}
.nc-msg--assistant .nc-msg-bubble {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-bottom-left-radius: 3px;
}
.nc-msg--err .nc-msg-bubble {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
  color: var(--c-error);
}

.nc-msg-text { white-space: pre-wrap; }

/* Code block inside messages */
.nc-code-block {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-dim);
  overflow-x: auto;
  margin: 6px 0 2px;
  white-space: pre;
  line-height: 1.55;
}

/* File chips in messages */
.nc-msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.nc-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  background: rgba(167, 139, 250, 0.07);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 4px;
  color: var(--c-agent);
}
.nc-file-size {
  color: var(--ink-mute);
  margin-left: 2px;
}

.nc-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.nc-meta-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  color: var(--ink-mute);
  background: var(--bg);
}
.nc-meta-chip.nc-meta-skill {
  color: var(--c-skill);
  border-color: rgba(244,184,96,0.25);
  background: rgba(244,184,96,0.05);
}

.nc-msg-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  padding: 0 4px;
}

/* Typing indicator */
.nc-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
}
.nc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-mute);
  animation: nc-bounce 1.3s ease-in-out infinite;
}
.nc-typing span:nth-child(2) { animation-delay: 0.18s; }
.nc-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes nc-bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.45; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Attachments preview bar */
.nc-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
  flex-shrink: 0;
}
.nc-att-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 4px 9px;
}
.nc-att-size {
  color: var(--ink-faint);
  font-size: 10px;
}
.nc-att-item button {
  background: none;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 0 0 0 2px;
  font-size: 14px;
  line-height: 1;
  transition: color 0.12s;
}
.nc-att-item button:hover { color: var(--c-error); }

/* Input bar */
.nc-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
  flex-shrink: 0;
}
.nc-textarea {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nc-textarea:focus {
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.07);
}
.nc-textarea::placeholder { color: var(--ink-faint); }
.nc-textarea:disabled { opacity: 0.45; cursor: not-allowed; }

/* Send button */
.nc-send {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-agent);
  border: none;
  border-radius: 8px;
  color: #08080b;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.nc-send:hover:not(:disabled) {
  background: #c4b5fd;
  transform: scale(1.04);
}
.nc-send:active:not(:disabled) { transform: scale(0.96); }
.nc-send:disabled { opacity: 0.32; cursor: not-allowed; }

/* Spin animation for loading state */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Nova Skill Modal — 2 etapas (KAN-500/501) ──────────────────────────── */
.ns-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.ns-panel {
  background: var(--bg-raised);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  width: min(560px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 0;
}
.ns-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.ns-title { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); }
.ns-title strong { color: var(--ink); }
.ns-subtitle {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute);
  padding: 10px 20px 6px;
}

/* Template gallery grid */
.ns-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; padding: 12px 20px 20px;
}
.ns-tpl-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
  text-align: center;
}
.ns-tpl-card:hover { border-color: var(--c-skill); background: rgba(244,184,96,0.05); color: var(--ink); }
.ns-tpl-icon { font-size: 22px; }
.ns-tpl-label { font-size: 11px; line-height: 1.3; }

/* Guided form */
.ns-form { display: flex; flex-direction: column; gap: 14px; padding: 14px 20px 4px; }
.ns-field { display: flex; flex-direction: column; gap: 5px; }
.ns-label { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.ns-req { color: var(--c-error); }
.ns-hint { font-size: 10px; color: var(--ink-mute); }
.ns-input, .ns-textarea, .ns-select {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 5px;
  padding: 7px 10px; color: var(--ink); font-family: var(--font-mono); font-size: 12px;
  resize: vertical; transition: border-color 0.15s;
  box-sizing: border-box; width: 100%;
}
.ns-input:focus, .ns-textarea:focus, .ns-select:focus {
  outline: none; border-color: var(--c-skill);
}
.ns-select { cursor: pointer; }
.ns-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 20px; gap: 8px;
}

/* Validation feedback (KAN-502) */
.na-editor-err { border-color: var(--c-error) !important; }
.na-valid-erros {
  background: rgba(248,113,113,0.06); border: 1px solid rgba(248,113,113,0.25);
  border-radius: 5px; padding: 8px 12px; display: flex; flex-direction: column; gap: 5px;
  font-family: var(--font-mono); font-size: 11px;
}
.na-valid-row { color: var(--ink-dim); line-height: 1.4; }
.na-valid-critico { color: var(--c-error); }
.na-valid-aviso { color: var(--c-warn); }

/* ── Login Screen (KAN-507) ──────────────────────────────────────────────── */
.nl-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.nl-box {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; width: 300px;
}
.nl-logo {
  font-family: var(--font-mono); font-size: 28px; letter-spacing: 0.18em;
  color: var(--ink); font-weight: 700;
}
.nl-sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.nl-field { width: 100%; }
.nl-input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 10px 14px; color: var(--ink);
  font-family: var(--font-mono); font-size: 13px; box-sizing: border-box;
  transition: border-color 0.15s;
}
.nl-input:focus { outline: none; border-color: var(--c-agent); }
.nl-err { font-family: var(--font-mono); font-size: 11px; color: var(--c-error); text-align: center; }
.nl-btn { width: 100%; justify-content: center; padding: 10px; }
.nl-hint { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); text-align: center; max-width: 260px; }

/* ── History Panel (KAN-509) ─────────────────────────────────────────────── */
.nh-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.68);
  display: flex; align-items: flex-start; justify-content: flex-end;
  z-index: 900;
  backdrop-filter: blur(1px);
}
.nh-panel {
  width: min(420px, 95vw); height: 100vh;
  background: var(--bg-panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  animation: slideInRight 0.18s ease;
}
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.nh-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.nh-title { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.nh-body { flex: 1; overflow-y: auto; }
.nh-entry {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
  transition: background 0.1s;
}
.nh-entry:hover { background: var(--bg-raised); }
.nh-entry-date { font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute); }
.nh-entry-msg  { font-family: var(--font-mono); font-size: 12px; color: var(--ink); line-height: 1.4; }
.nh-entry-meta { display: flex; gap: 10px; align-items: center; margin-top: 2px; }
.nh-author     { font-family: var(--font-mono); font-size: 10px; color: var(--c-agent); }
.nh-hash       { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); cursor: help; }

/* ── Read-only badge ─────────────────────────────────────────────────────── */
.na-readonly-badge {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute);
  background: rgba(107,111,121,0.08); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 10px; margin-top: 6px;
}

/* ── Monitor panel (saude / metricas / logs) ─────────────────────────────── */
.nm-panel { width: min(960px, 94vw); max-height: 88vh; }
.nm-agent { width: 120px; }
.nm-status { display:inline-flex; align-items:center; gap:6px; font-size:11px; font-weight:600; letter-spacing:.06em; }
.nm-healthy { color:#3fb950; } .nm-degraded { color:#d29922; }
.nm-down { color:#f85149; } .nm-idle { color:#6b6f79; }
.nm-body { padding:16px; overflow:auto; }
.nm-err { color:#f85149; margin-bottom:12px; font-size:13px; }
.nm-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:10px; margin-bottom:14px; }
.nm-card { background:rgba(255,255,255,.03); border:1px solid #1d1f26; border-radius:8px; padding:10px 12px; }
.nm-v { font-size:18px; font-weight:700; color:#e9eaec; }
.nm-k { font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:#6b6f79; margin-top:2px; }
.nm-health { margin:14px 0; font-size:12px; color:#a8abb4; }
.nm-logs { overflow:auto; border:1px solid #1d1f26; border-radius:8px; }
.nm-table { width:100%; border-collapse:collapse; font-size:11px; }
.nm-table th, .nm-table td { text-align:left; padding:6px 8px; border-bottom:1px solid #1d1f26; white-space:nowrap; }
.nm-table th { color:#6b6f79; font-weight:600; }
.nm-ok { color:#3fb950; } .nm-bad { color:#f85149; }
.nm-empty { color:#6b6f79; text-align:center; padding:14px; }
