:root {
  --nx-bg: #050811;
  --nx-bg-2: #070b16;
  --nx-card: #0f172a;
  --nx-card-2: rgba(15, 23, 42, 0.72);
  --nx-neon: #00f0ff;
  --nx-cyan: #00e5ff;
  --nx-violet: #8b5cf6;
  --nx-green: #22ff88;
  --nx-red: #ff3b6b;
  --nx-amber: #fbbf24;
  --nx-text: #e8f4ff;
  --nx-muted: #8ba0b8;
  --nx-line: rgba(0, 240, 255, 0.22);
  --nx-glow: 0 0 18px rgba(0, 240, 255, 0.35);
  --sidebar: 268px;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  background: var(--nx-bg);
  color: var(--nx-text);
}

body.nx-body {
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body.nx-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(0, 240, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 20% 0%, #000 20%, transparent 70%);
}

body.nx-body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.25;
}

.nx-app { position: relative; z-index: 2; }

.font-orbitron { font-family: "Orbitron", sans-serif; }
.font-mono-tech { font-family: "Share Tech Mono", ui-monospace, monospace; }

.nx-glass {
  background: var(--nx-card-2);
  border: 1px solid var(--nx-line);
  backdrop-filter: blur(16px);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.08), var(--nx-glow);
}

.nx-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(8, 12, 24, 0.92));
  border: 1px solid var(--nx-line);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(0, 240, 255, 0.08);
}

.nx-card:hover {
  border-color: rgba(0, 240, 255, 0.45);
}

.nx-neon-text {
  color: var(--nx-neon);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.65);
}

.nx-violet-text {
  color: var(--nx-violet);
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.55);
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}

.led-online {
  background: var(--nx-green);
  color: var(--nx-green);
  animation: nxPulse 1.6s ease-in-out infinite;
}

.led-offline {
  background: #4b5563;
  color: #4b5563;
  box-shadow: none;
}

@keyframes nxPulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px currentColor; }
  50% { opacity: 0.55; transform: scale(0.86); box-shadow: 0 0 18px currentColor; }
}

.nx-sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, rgba(7, 11, 22, 0.96), rgba(5, 8, 17, 0.98));
  border-right: 1px solid var(--nx-line);
  transition: width 0.28s ease, transform 0.28s ease;
}

.nx-sidebar.collapsed { width: 84px; }
.nx-sidebar.collapsed .sidebar-label { display: none; }

.nx-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--nx-muted);
  border: 1px solid transparent;
  transition: 0.18s ease;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nx-nav-btn:hover {
  color: var(--nx-text);
  background: rgba(0, 240, 255, 0.06);
}

.nx-nav-btn.active {
  color: var(--nx-neon);
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), rgba(139, 92, 246, 0.12));
  border-color: var(--nx-line);
  box-shadow: var(--nx-glow);
}

.nx-input, .nx-select, .nx-textarea {
  width: 100%;
  background: rgba(5, 8, 17, 0.85);
  border: 1px solid var(--nx-line);
  color: var(--nx-text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  font-family: inherit;
}

.nx-input:focus, .nx-select:focus, .nx-textarea:focus {
  border-color: var(--nx-neon);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.12), var(--nx-glow);
}

.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: 0.18s ease;
  border: 1px solid transparent;
}

.nx-btn-primary {
  background: linear-gradient(90deg, #00c6d8, #8b5cf6);
  color: #041018;
  box-shadow: var(--nx-glow);
}

.nx-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }

.nx-btn-ghost {
  background: transparent;
  color: var(--nx-neon);
  border-color: var(--nx-line);
}

.nx-btn-ghost:hover { background: rgba(0, 240, 255, 0.08); }

.nx-btn-danger {
  background: rgba(255, 59, 107, 0.12);
  color: #ff8aa8;
  border-color: rgba(255, 59, 107, 0.4);
}

.nx-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.nx-switch input { display: none; }

.nx-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  cursor: pointer;
  transition: 0.2s ease;
}

.nx-switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 999px;
  background: #64748b;
  transition: 0.2s ease;
}

.nx-switch input:checked + span {
  background: rgba(0, 240, 255, 0.18);
  border-color: var(--nx-neon);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}

.nx-switch input:checked + span::after {
  left: 25px;
  background: var(--nx-neon);
  box-shadow: 0 0 10px var(--nx-neon);
}

.nx-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 14, 0.72);
  backdrop-filter: blur(8px);
}

.nx-modal.open { display: flex; }

.nx-modal-box {
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 18px;
}

.toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nx-toast {
  min-width: 280px;
  max-width: 380px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--nx-line);
  background: rgba(15, 23, 42, 0.94);
  box-shadow: var(--nx-glow);
  animation: toastIn 0.25s ease;
}

.nx-toast.ok { border-color: rgba(34, 255, 136, 0.45); }
.nx-toast.err { border-color: rgba(255, 59, 107, 0.55); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.view { display: none; }
.view.active { display: block; animation: fadeView 0.22s ease; }

@keyframes fadeView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.metric-value {
  font-family: "Orbitron", sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.04em;
}

.capture-tile {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--nx-line);
  aspect-ratio: 16 / 10;
  background: #020617;
}

.capture-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.3s ease;
}

.capture-tile:hover img { transform: scale(1.05); }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.18), transparent 32%),
    radial-gradient(circle at 80% 80%, rgba(0, 240, 255, 0.16), transparent 28%),
    #050811;
}

.login-orbit {
  position: absolute;
  width: 520px;
  height: 520px;
  border: 1px dashed rgba(0, 240, 255, 0.18);
  border-radius: 999px;
  animation: spin 28s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.25); border-radius: 99px; }

@media (max-width: 980px) {
  .nx-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
  }
  .nx-sidebar.mobile-open { transform: none; width: var(--sidebar); }
}
