/* ═══════════════════════════════════════════════════════════
   NEXUS PRIME OS — Design System v2 "Obsidian Aurora"
   ═══════════════════════════════════════════════════════════ */

:root {
  --prime: #5eead4;
  --edge: rgba(148, 163, 199, 0.10);
  --edge-hi: rgba(148, 163, 199, 0.18);
  --panel-bg: rgba(15, 20, 32, 0.72);
}

* { scrollbar-width: thin; scrollbar-color: #263248 transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-thumb { background: #263248; border-radius: 4px; }
::selection { background: rgba(94,234,212,0.25); color: #eafffa; }

body { background: #05070d; min-height: 100vh; }

/* ── Aurora ambient background ── */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 40% at 15% -5%, rgba(45,212,191,0.10), transparent 60%),
    radial-gradient(ellipse 45% 35% at 85% 0%, rgba(96,165,250,0.09), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 110%, rgba(167,139,250,0.07), transparent 60%),
    #05070d;
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { filter: hue-rotate(0deg) brightness(1); }
  100% { filter: hue-rotate(18deg) brightness(1.15); }
}
/* Grid overlay sutil */
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(148,163,199,0.033) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,199,0.033) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 85%);
}

/* ── Splash ── */
#splash { background: #05070d; }
.nexus-logo-splash { width: 96px; height: 96px; position: relative; }
.nexus-core {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(94,234,212,0.12);
  border-top-color: #5eead4; border-right-color: rgba(96,165,250,0.6);
  animation: spin 1s cubic-bezier(.6,.15,.4,.85) infinite;
}
.nexus-core::before {
  content: ''; position: absolute; inset: 10px; border-radius: 50%;
  border: 1px solid rgba(96,165,250,0.15); border-bottom-color: rgba(167,139,250,0.7);
  animation: spin 1.6s linear infinite reverse;
}
.nexus-core::after {
  content: ''; position: absolute; inset: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(94,234,212,1), rgba(96,165,250,0.5) 70%);
  box-shadow: 0 0 32px rgba(94,234,212,0.6), 0 0 80px rgba(94,234,212,0.25);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(0.85); opacity: .75 } 50% { transform: scale(1.06); opacity: 1 } }

/* ── Panels: glass + depth ── */
.panel {
  background: linear-gradient(165deg, rgba(20,26,42,0.75), rgba(11,15,25,0.85));
  border: 1px solid var(--edge);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 12px 32px -16px rgba(0,0,0,0.6);
  transition: border-color .25s, box-shadow .25s;
}
.panel:hover { border-color: var(--edge-hi); }
.panel-glow { position: relative; }
.panel-glow::before {
  content: ''; position: absolute; inset: -1px; border-radius: 16px; padding: 1px;
  background: linear-gradient(135deg, rgba(94,234,212,0.45), rgba(96,165,250,0.12) 35%, transparent 55%, rgba(167,139,250,0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.panel-glow::after {
  content: ''; position: absolute; top: 0; left: 8%; right: 8%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94,234,212,0.5), transparent);
  pointer-events: none;
}

/* ── Sidebar ── */
#sidebar {
  background: linear-gradient(180deg, rgba(13,17,28,0.92), rgba(8,11,19,0.96));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--edge);
}
#sidebar header { position: relative; }
#sidebar header::after {
  content: ''; position: absolute; bottom: -1px; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94,234,212,0.35), transparent);
}
.brand-logo { filter: drop-shadow(0 0 12px rgba(94,234,212,0.35)); }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9.5px 14px;
  border-radius: 11px; color: #7d8aa3; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .16s; border: 1px solid transparent;
  white-space: nowrap; position: relative;
}
.nav-item:hover { color: #e4e9f2; background: rgba(148,163,199,0.06); transform: translateX(2px); }
.nav-item.active {
  color: #5eead4;
  background: linear-gradient(90deg, rgba(94,234,212,0.10), rgba(94,234,212,0.02));
  border-color: rgba(94,234,212,0.18);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 22%; bottom: 22%; width: 3px;
  border-radius: 3px; background: linear-gradient(180deg, #5eead4, #60a5fa);
  box-shadow: 0 0 10px rgba(94,234,212,0.7);
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; transition: transform .16s; }
.nav-item:hover i { transform: scale(1.12); }

/* ── Topbar ── */
#topbar {
  background: rgba(8,11,19,0.65);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--edge);
}

/* ── Metric tiles ── */
.metric-tile {
  background: linear-gradient(160deg, rgba(20,26,42,0.7), rgba(11,15,25,0.82));
  border: 1px solid var(--edge); border-radius: 15px; padding: 18px 20px;
  transition: all .22s cubic-bezier(.3,.7,.4,1); cursor: pointer;
  position: relative; overflow: hidden;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.metric-tile::before {
  content: ''; position: absolute; top: -40%; right: -20%; width: 90px; height: 90px;
  border-radius: 50%; background: radial-gradient(circle, var(--tile-glow, rgba(94,234,212,0.12)), transparent 70%);
  opacity: 0; transition: opacity .25s;
}
.metric-tile:hover { border-color: var(--edge-hi); transform: translateY(-3px); box-shadow: 0 16px 32px -18px rgba(0,0,0,0.8); }
.metric-tile:hover::before { opacity: 1; }
.metric-value {
  font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; line-height: 1;
  letter-spacing: -0.02em;
}

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; font-family: 'JetBrains Mono', monospace; letter-spacing: .05em; text-transform: uppercase; }
.badge-prime { background: rgba(94,234,212,0.09); color: #5eead4; border: 1px solid rgba(94,234,212,0.28); box-shadow: 0 0 12px -4px rgba(94,234,212,0.4); }
.badge-amber { background: rgba(251,191,36,0.09); color: #fbbf24; border: 1px solid rgba(251,191,36,0.28); }
.badge-rose { background: rgba(251,113,133,0.09); color: #fb7185; border: 1px solid rgba(251,113,133,0.28); }
.badge-violet { background: rgba(167,139,250,0.09); color: #a78bfa; border: 1px solid rgba(167,139,250,0.28); }
.badge-blue { background: rgba(96,165,250,0.09); color: #60a5fa; border: 1px solid rgba(96,165,250,0.28); }
.badge-dim { background: rgba(139,149,169,0.07); color: #8b95a9; border: 1px solid rgba(139,149,169,0.18); }

/* ── Buttons ── */
.btn-prime {
  background: linear-gradient(135deg, #34e0c8, #0ea5a3); color: #032726;
  font-weight: 650; padding: 9px 18px; border-radius: 11px; font-size: 13px;
  transition: all .18s cubic-bezier(.3,.7,.4,1.2);
  box-shadow: 0 0 0 1px rgba(94,234,212,0.35) inset, 0 4px 20px -4px rgba(45,212,191,0.5);
  border: none; cursor: pointer; position: relative; overflow: hidden;
}
.btn-prime::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-20deg); transition: left .45s;
}
.btn-prime:hover { box-shadow: 0 0 0 1px rgba(94,234,212,0.5) inset, 0 6px 32px -4px rgba(45,212,191,0.7); transform: translateY(-1px); }
.btn-prime:hover::after { left: 130%; }
.btn-prime:active { transform: translateY(0) scale(.98); }
.btn-ghost {
  border: 1px solid var(--edge-hi); color: #8b95a9; padding: 8px 16px;
  background: rgba(148,163,199,0.04);
  border-radius: 11px; font-size: 13px; font-weight: 500; transition: all .16s; cursor: pointer;
}
.btn-ghost:hover { border-color: rgba(94,234,212,0.4); color: #5eead4; background: rgba(94,234,212,0.05); }
.btn-ghost:active { transform: scale(.98); }

/* ── Inputs ── */
.input-dark {
  background: rgba(5,8,14,0.75); border: 1px solid var(--edge); border-radius: 11px;
  padding: 9.5px 14px; font-size: 13px; color: #e4e9f2; width: 100%;
  transition: all .18s; outline: none;
}
.input-dark:focus { border-color: rgba(94,234,212,0.45); box-shadow: 0 0 0 3px rgba(94,234,212,0.08), 0 0 20px -6px rgba(94,234,212,0.3); }
.input-dark::placeholder { color: #46506384; }
select.input-dark option { background: #0d1119; }
input[type="checkbox"] { accent-color: #2dd4bf; }

/* ── Agent orbs ── */
.agent-orb {
  width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk'; font-weight: 700; font-size: 15px; position: relative; flex-shrink: 0;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04) inset;
  transition: transform .18s;
}
.agent-orb:hover { transform: scale(1.06) rotate(-2deg); }
.agent-orb::after { content: ''; position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #0b0f19; }
.agent-orb.st-active::after, .agent-orb.st-running::after { background: #34d399; box-shadow: 0 0 10px #34d399; }
.agent-orb.st-running::after { animation: pulse 1.1s infinite; }
.agent-orb.st-idle::after { background: #64748b; }
.agent-orb.st-paused::after { background: #fbbf24; }
.agent-orb.st-error::after { background: #fb7185; }

/* ── Kanban ── */
.kanban-col { min-width: 266px; max-width: 282px; flex-shrink: 0; }
.kanban-card {
  background: linear-gradient(155deg, rgba(22,28,44,0.85), rgba(13,17,27,0.9));
  border: 1px solid var(--edge); border-radius: 12px; padding: 12px 14px; cursor: grab;
  transition: all .16s; backdrop-filter: blur(8px);
}
.kanban-card:hover { border-color: rgba(94,234,212,0.32); transform: translateY(-2px); box-shadow: 0 8px 20px -10px rgba(0,0,0,0.7); }
.kanban-card.dragging { opacity: 0.35; transform: rotate(2deg) scale(.98); }
.kanban-col.dragover .kanban-drop { border-color: rgba(94,234,212,0.5); background: rgba(94,234,212,0.045); }
.kanban-drop { border: 1.5px dashed transparent; border-radius: 13px; min-height: 64px; transition: all .16s; }

/* ── Terminal ── */
.terminal {
  background: linear-gradient(180deg, #04060b, #060910);
  border: 1px solid var(--edge); border-radius: 13px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  box-shadow: 0 0 0 1px rgba(94,234,212,0.04) inset;
}
.terminal-out { max-height: 380px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }

/* ── Feed ── */
.feed-line { display: flex; gap: 10px; padding: 9px 6px; border-bottom: 1px solid rgba(148,163,199,0.06); font-size: 12.5px; border-radius: 8px; transition: background .15s; }
.feed-line:hover { background: rgba(148,163,199,0.04); }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }

/* ── OODA phases ── */
.ooda-phase { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; position: relative; }
.ooda-phase:not(:last-child)::after { content: ''; position: absolute; top: 13px; left: 55%; width: 90%; height: 2px; background: rgba(148,163,199,0.12); }
.ooda-phase.done:not(:last-child)::after { background: linear-gradient(90deg, rgba(94,234,212,0.55), rgba(94,234,212,0.2)); }
.ooda-node {
  width: 27px; height: 27px; border-radius: 50%; border: 2px solid rgba(148,163,199,0.18);
  background: #0b0f19; display: flex; align-items: center; justify-content: center;
  font-size: 10px; z-index: 1; color: #4a5568; transition: all .3s;
}
.ooda-phase.done .ooda-node { border-color: #5eead4; color: #5eead4; }
.ooda-phase.current .ooda-node {
  border-color: #5eead4; background: rgba(94,234,212,0.14); color: #5eead4;
  box-shadow: 0 0 16px rgba(94,234,212,0.5); animation: nodePulse 2s ease-in-out infinite;
}
@keyframes nodePulse { 0%,100% { box-shadow: 0 0 12px rgba(94,234,212,0.35) } 50% { box-shadow: 0 0 22px rgba(94,234,212,0.65) } }

/* ── Health rings ── */
.health-ring { transform: rotate(-90deg); }
.health-ring circle { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 1s cubic-bezier(.3,.7,.4,1); }

#graph-canvas { width: 100%; border-radius: 13px; background: radial-gradient(circle at 50% 40%, rgba(94,234,212,0.04), transparent), #070a12; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3,5,9,0.78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .18s ease; }
.modal-box {
  background: linear-gradient(170deg, rgba(18,24,38,0.97), rgba(10,14,23,0.99));
  border: 1px solid rgba(148,163,199,0.16); border-radius: 18px;
  max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto;
  animation: modalIn .26s cubic-bezier(.2,.9,.3,1.15);
  box-shadow: 0 24px 80px -20px rgba(0,0,0,0.9), 0 0 0 1px rgba(94,234,212,0.05) inset;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.94) translateY(14px) } to { opacity: 1; transform: none } }

/* ── Chat ── */
.chat-bubble-agent { background: linear-gradient(155deg, rgba(22,28,44,0.85), rgba(13,17,27,0.92)); border: 1px solid var(--edge); border-radius: 4px 16px 16px 16px; backdrop-filter: blur(8px); }
.chat-bubble-user { background: linear-gradient(135deg, rgba(94,234,212,0.10), rgba(96,165,250,0.06)); border: 1px solid rgba(94,234,212,0.22); border-radius: 16px 4px 16px 16px; }

/* ── Typography & misc ── */
.section-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: -0.015em; }
.mono { font-family: 'JetBrains Mono', monospace; }
.fade-in { animation: fadeIn .4s cubic-bezier(.2,.8,.3,1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* Stagger para grids */
.fade-in > section { animation: fadeIn .45s cubic-bezier(.2,.8,.3,1) backwards; }
.fade-in > section:nth-child(2) { animation-delay: .06s; }
.fade-in > section:nth-child(3) { animation-delay: .12s; }
.fade-in > section:nth-child(4) { animation-delay: .18s; }

.tab-pill { padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #8b95a9; cursor: pointer; border: 1px solid rgba(148,163,199,0.14); background: rgba(148,163,199,0.03); transition: all .15s; }
.tab-pill.active, .tab-pill:hover { color: #5eead4; background: rgba(94,234,212,0.08); border-color: rgba(94,234,212,0.3); }

.pbar { height: 5px; border-radius: 999px; background: rgba(148,163,199,0.1); overflow: hidden; }
.pbar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2dd4bf, #60a5fa); transition: width .8s cubic-bezier(.3,.7,.4,1); box-shadow: 0 0 8px rgba(94,234,212,0.5); }

#install-banner { animation: slideUp .4s cubic-bezier(.2,.9,.3,1.1); }
@keyframes slideUp { from { transform: translateY(120%); } to { transform: none; } }

/* Hero */
.hero-panel { position: relative; overflow: hidden; }
.hero-panel::after {
  content: ''; position: absolute; top: -60%; right: -10%; width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(94,234,212,0.10), transparent 65%);
  pointer-events: none; animation: heroGlow 6s ease-in-out infinite alternate;
}
@keyframes heroGlow { from { transform: scale(1); opacity: .8 } to { transform: scale(1.25); opacity: 1 } }

/* Live dot */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; position: relative; }
.live-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid rgba(52,211,153,0.5); animation: ripple 1.8s ease-out infinite; }
@keyframes ripple { from { transform: scale(.6); opacity: 1 } to { transform: scale(1.6); opacity: 0 } }

table tbody tr { transition: background .15s; }
table tbody tr:hover { background: rgba(148,163,199,0.04); }

@media (max-width: 1024px) {
  #sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .28s cubic-bezier(.3,.7,.4,1); height: 100vh; }
  #sidebar.open { transform: none; box-shadow: 24px 0 60px rgba(0,0,0,0.6); }
}
