/* ============================================================
   NEXORA — Ultra-Premium Design System v3.0
   Dark-first · Apple-grade · Cinematic
   "Software interno da Apple para engenharia de dados críticos"
   ============================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Surface Hierarchy — Deep Obsidian */
  --nx-void:       #000000;
  --nx-bg:         #09090B;
  --nx-bg-subtle:  #0C0C0F;
  --nx-bg-raised:  #111114;
  --nx-bg-elevated:#161619;
  --nx-bg-overlay: #1A1A1E;

  /* Borders — whisper-thin */
  --nx-border:       rgba(255,255,255,0.06);
  --nx-border-subtle:rgba(255,255,255,0.04);
  --nx-border-strong:rgba(255,255,255,0.10);

  /* Text Hierarchy */
  --nx-text:       #EDEDF0;
  --nx-text-secondary: #8B8B9E;
  --nx-text-muted: #56566A;
  --nx-text-ghost: #38384A;

  /* Purple Identity — Nexora Signature */
  --nx-purple:     #8B5CF6;
  --nx-purple-dim: #7C3AED;
  --nx-purple-vivid:#A78BFA;
  --nx-purple-glow: rgba(139, 92, 246, 0.15);
  --nx-purple-glow-strong: rgba(139, 92, 246, 0.25);

  /* Accent Gradient */
  --nx-gradient: linear-gradient(135deg, #8B5CF6 0%, #6366F1 50%, #4F46E5 100%);
  --nx-gradient-vivid: linear-gradient(135deg, #A78BFA, #818CF8, #6366F1);

  /* Semantic */
  --nx-success:   #22C55E;
  --nx-warning:   #F59E0B;
  --nx-danger:    #EF4444;
  --nx-info:      #3B82F6;

  /* Shadows — deep space */
  --nx-shadow-sm:  0 1px 2px rgba(0,0,0,0.5), 0 0 1px rgba(0,0,0,0.3);
  --nx-shadow-md:  0 4px 12px rgba(0,0,0,0.4), 0 0 1px rgba(0,0,0,0.2);
  --nx-shadow-lg:  0 8px 28px rgba(0,0,0,0.5), 0 0 1px rgba(0,0,0,0.2);
  --nx-shadow-xl:  0 16px 48px rgba(0,0,0,0.6), 0 0 1px rgba(0,0,0,0.3);
  --nx-shadow-glow:0 0 24px -4px rgba(139, 92, 246, 0.3), 0 0 8px -2px rgba(139, 92, 246, 0.15);
  --nx-shadow-glow-strong: 0 0 40px -6px rgba(139, 92, 246, 0.45);

  /* Radius */
  --nx-radius-xs: 6px;
  --nx-radius-sm: 8px;
  --nx-radius-md: 10px;
  --nx-radius-lg: 14px;
  --nx-radius-xl: 18px;

  /* Timing — spring physics feel */
  --nx-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nx-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --nx-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --nx-duration: 250ms;
  --nx-duration-slow: 400ms;

  /* Theme-scoped channels (dark defaults) */
  --nx-sidebar-bg: rgba(9, 9, 11, 0.92);
  --nx-topbar-bg: rgba(9, 9, 11, 0.75);
  --nx-glass-bg: rgba(17, 17, 20, 0.6);
  --nx-scrollbar-thumb: rgba(139, 92, 246, 0.2);
  --nx-scrollbar-thumb-hover: rgba(139, 92, 246, 0.4);
  --nx-modal-backdrop: rgba(0, 0, 0, 0.72);
  --nx-overlay-backdrop: rgba(0, 0, 0, 0.7);
  --nx-active-text: #fff;
  --nx-color-scheme: dark;
  --nx-ambient-glow: rgba(139, 92, 246, 0.06);
  --nx-selection-bg: rgba(139, 92, 246, 0.3);
  --nx-selection-text: #fff;
}

html { color-scheme: var(--nx-color-scheme); }

/* ── Light Mode Theme ───────────────────────────────────────── */
[data-theme="light"] {
  /* Surface Hierarchy — Clean Paper */
  --nx-void:       #FFFFFF;
  --nx-bg:         #FAFAF9;
  --nx-bg-subtle:  #F5F5F4;
  --nx-bg-raised:  #FFFFFF;
  --nx-bg-elevated:#F9F9F8;
  --nx-bg-overlay: #F3F3F2;

  /* Borders — subtle gray */
  --nx-border:       rgba(0, 0, 0, 0.08);
  --nx-border-subtle:rgba(0, 0, 0, 0.04);
  --nx-border-strong:rgba(0, 0, 0, 0.12);

  /* Text Hierarchy */
  --nx-text:           #18181B;
  --nx-text-secondary: #52525B;
  --nx-text-muted:     #71717A;
  --nx-text-ghost:     #A1A1AA;

  /* Purple Identity — same across themes */
  --nx-purple:     #8B5CF6;
  --nx-purple-dim: #7C3AED;
  --nx-purple-vivid:#6D28D9;
  --nx-purple-glow: rgba(139, 92, 246, 0.08);
  --nx-purple-glow-strong: rgba(139, 92, 246, 0.12);

  /* Accent Gradient */
  --nx-gradient: linear-gradient(135deg, #8B5CF6 0%, #6366F1 50%, #4F46E5 100%);
  --nx-gradient-vivid: linear-gradient(135deg, #7C3AED, #6366F1, #4F46E5);

  /* Semantic — adjusted for light mode */
  --nx-success:   #10B981;
  --nx-warning:   #F59E0B;
  --nx-danger:    #EF4444;
  --nx-info:      #3B82F6;

  /* Shadows — light and subtle */
  --nx-shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.03);
  --nx-shadow-md:  0 4px 12px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.02);
  --nx-shadow-lg:  0 8px 28px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.02);
  --nx-shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.03);
  --nx-shadow-glow:0 0 24px -4px rgba(139, 92, 246, 0.15), 0 0 8px -2px rgba(139, 92, 246, 0.08);
  --nx-shadow-glow-strong: 0 0 40px -6px rgba(139, 92, 246, 0.25);

  /* Radius — same as dark */
  --nx-radius-xs: 6px;
  --nx-radius-sm: 8px;
  --nx-radius-md: 10px;
  --nx-radius-lg: 14px;
  --nx-radius-xl: 18px;

  /* Timing — same as dark */
  --nx-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nx-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --nx-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --nx-duration: 250ms;
  --nx-duration-slow: 400ms;

  /* Theme-scoped channels — light */
  --nx-sidebar-bg: rgba(255, 255, 255, 0.88);
  --nx-topbar-bg: rgba(255, 255, 255, 0.80);
  --nx-glass-bg: rgba(255, 255, 255, 0.72);
  --nx-scrollbar-thumb: rgba(124, 58, 237, 0.30);
  --nx-scrollbar-thumb-hover: rgba(124, 58, 237, 0.55);
  --nx-modal-backdrop: rgba(17, 17, 20, 0.45);
  --nx-overlay-backdrop: rgba(17, 17, 20, 0.35);
  --nx-active-text: #18181B;
  --nx-color-scheme: light;
  --nx-ambient-glow: rgba(124, 58, 237, 0.05);
  --nx-selection-bg: rgba(124, 58, 237, 0.22);
  --nx-selection-text: #18181B;
}

/* ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--nx-bg);
  color: var(--nx-text);
  line-height: 1.6;
  letter-spacing: -0.011em;
}

::selection {
  background: var(--nx-selection-bg);
  color: var(--nx-selection-text);
}

/* ── Scrollbar — Invisible until hover ──────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--nx-scrollbar-thumb);
  border-radius: 100px;
  transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover { background: var(--nx-scrollbar-thumb-hover); }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes nx-entrance {
  from { opacity: 0; transform: translateY(8px) scale(0.98); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes nx-slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nx-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes nx-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes nx-glow-pulse {
  0%, 100% { box-shadow: 0 0 12px -2px rgba(139, 92, 246, 0.15); }
  50%      { box-shadow: 0 0 20px -2px rgba(139, 92, 246, 0.3); }
}
@keyframes nx-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes nx-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes nx-dot-breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}
@keyframes nx-border-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes nx-float-subtle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.animate-entrance    { animation: nx-entrance 0.6s var(--nx-ease) both; }
.animate-slide-down  { animation: nx-slide-down 0.35s var(--nx-ease) both; }
.animate-scale-in    { animation: nx-scale-in 0.35s var(--nx-ease) both; }
.animate-fade        { animation: nx-fade 0.4s var(--nx-ease) both; }
.animate-float       { animation: nx-float-subtle 6s ease-in-out infinite; }

.stagger-1 { animation-delay: 60ms; }
.stagger-2 { animation-delay: 120ms; }
.stagger-3 { animation-delay: 180ms; }
.stagger-4 { animation-delay: 240ms; }
.stagger-5 { animation-delay: 300ms; }

/* ── Skeleton ───────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--nx-bg-raised) 25%, var(--nx-bg-elevated) 50%, var(--nx-bg-raised) 75%);
  background-size: 200% 100%;
  animation: nx-shimmer 2s ease-in-out infinite;
  border-radius: var(--nx-radius-sm);
}

/* ── Gradient Helpers ───────────────────────────────────────── */
.nx-gradient-bg  { background: var(--nx-gradient); }
.nx-gradient-text {
  background: var(--nx-gradient-vivid);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Glassmorphism ──────────────────────────────────────────── */
.nx-glass {
  background: var(--nx-glass-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--nx-border);
}

/* ── SIDEBAR — Ultra Premium ────────────────────────────────── */
.nx-sidebar {
  background: var(--nx-sidebar-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-right: 1px solid var(--nx-border-subtle);
  transition: background var(--nx-duration) var(--nx-ease),
              transform var(--nx-duration-slow) var(--nx-ease),
              width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden; /* inner <nav> handles its own scrolling */
}
/* Collapsed sidebar must show right-edge tooltips */
.nx-sidebar-collapsed { overflow: visible; }
/* Ambient glow behind sidebar */
.nx-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: radial-gradient(ellipse at 30% 0%, var(--nx-ambient-glow) 0%, transparent 70%);
  pointer-events: none;
}

.nx-sidebar-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--nx-text-ghost);
  padding: 0 12px;
  margin-bottom: 6px;
}

.nx-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--nx-radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--nx-text-secondary);
  transition: all var(--nx-duration) var(--nx-ease);
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
}
.nx-sidebar-link:hover {
  color: var(--nx-text);
  background: rgba(139, 92, 246, 0.06);
  border-color: rgba(139, 92, 246, 0.08);
}
.nx-sidebar-link:hover svg {
  color: var(--nx-purple-vivid) !important;
}

/* Active state — animated indicator bar */
.nx-sidebar-link.active {
  color: var(--nx-active-text);
  background: var(--nx-purple-glow);
  border-color: rgba(139, 92, 246, 0.18);
  font-weight: 600;
}
.nx-sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--nx-gradient);
  box-shadow: var(--nx-shadow-glow);
  animation: nx-glow-pulse 3s ease-in-out infinite;
}
.nx-sidebar-link.active svg {
  color: var(--nx-purple-vivid) !important;
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.4));
}

.nx-sidebar-logo-button {
  background: var(--nx-bg-raised) !important;
  border: 1px solid var(--nx-border-strong);
  box-shadow: var(--nx-shadow-sm) !important;
  padding: 4px;
}
.nx-sidebar-logo-button:hover {
  background: var(--nx-bg-elevated) !important;
  border-color: rgba(139, 92, 246, 0.24);
}
.nx-sidebar-logo-button svg {
  color: var(--nx-purple-vivid) !important;
}
.nx-sidebar-logo-image {
  border-radius: 6px;
  background: #fff;
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.nx-topbar {
  height: 56px;
  background: var(--nx-topbar-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--nx-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.nx-topbar-search {
  position: relative;
  align-items: center;
  width: min(260px, 32vw);
  height: 34px;
  color: var(--nx-text-muted);
}
.nx-topbar-search-icon {
  position: absolute;
  left: 11px;
  width: 14px;
  height: 14px;
  color: var(--nx-text-ghost);
  pointer-events: none;
}
.nx-topbar-search-input {
  width: 100%;
  height: 34px;
  padding: 0 58px 0 34px;
  font-size: 12px;
  font-weight: 500;
  color: var(--nx-text);
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-md);
  outline: none;
  transition: all var(--nx-duration) var(--nx-ease);
  caret-color: var(--nx-purple);
}
.nx-topbar-search-input::placeholder {
  color: var(--nx-text-ghost);
}
.nx-topbar-search-input:focus {
  border-color: rgba(139, 92, 246, 0.45);
  background: var(--nx-bg-elevated);
  box-shadow: 0 0 0 3px var(--nx-purple-glow);
}
.nx-topbar-search-kbd {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.nx-search-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 80vw);
  max-height: min(420px, 70vh);
  overflow-y: auto;
  z-index: 80;
}
.nx-search-menu-section {
  padding: 6px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nx-text-ghost);
}
.nx-search-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--nx-radius-xs);
  color: var(--nx-text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.nx-search-menu-item:hover,
.nx-search-menu-item:focus-visible {
  background: var(--nx-purple-glow);
  color: var(--nx-purple-vivid);
  outline: none;
}
.nx-search-menu-item small {
  color: var(--nx-text-ghost);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── BUTTON SYSTEM ──────────────────────────────────────────── */
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  border-radius: var(--nx-radius-md);
  padding: 9px 18px;
  transition: all var(--nx-duration) var(--nx-ease);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}
.nx-btn:active { transform: scale(0.96); }

/* Primary — signature gradient with glow */
.nx-btn-primary {
  color: #fff;
  background: var(--nx-gradient);
  border: none;
  box-shadow: var(--nx-shadow-glow), inset 0 1px 0 rgba(255,255,255,0.1);
}
.nx-btn-primary:hover {
  box-shadow: var(--nx-shadow-glow-strong), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* Secondary — ghost glass */
.nx-btn-secondary {
  color: var(--nx-text-secondary);
  background: var(--nx-bg-elevated);
  border-color: var(--nx-border-strong);
}
.nx-btn-secondary:hover {
  color: var(--nx-text);
  border-color: rgba(139, 92, 246, 0.2);
  background: var(--nx-bg-overlay);
}

/* Danger */
.nx-btn-danger {
  color: #FCA5A5;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.15);
}
.nx-btn-danger:hover {
  color: #FEE2E2;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.25);
}

/* Ghost */
.nx-btn-ghost {
  color: var(--nx-text-secondary);
  background: transparent;
  border-color: transparent;
}
.nx-btn-ghost:hover {
  color: var(--nx-text);
  background: var(--nx-bg-elevated);
}

.nx-btn-sm { font-size: 12px; padding: 7px 14px; }
.nx-btn-lg { font-size: 14px; padding: 12px 24px; }

/* ── INPUT SYSTEM — Floating Labels ─────────────────────────── */
.nx-field {
  position: relative;
}
.nx-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--nx-text);
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-md);
  outline: none;
  transition: all var(--nx-duration) var(--nx-ease);
  caret-color: var(--nx-purple);
}
.nx-input::placeholder { color: var(--nx-text-ghost); }
.nx-input:hover {
  border-color: rgba(139, 92, 246, 0.15);
  background: var(--nx-bg-elevated);
}
.nx-input:focus {
  border-color: var(--nx-purple) !important;
  box-shadow: 0 0 0 3px var(--nx-purple-glow), var(--nx-shadow-sm) !important;
  background: var(--nx-bg-elevated) !important;
  outline: none !important;
}

/* Floating label */
.nx-field .nx-input:not(:placeholder-shown) + .nx-float-label,
.nx-field .nx-input:focus + .nx-float-label {
  transform: translateY(-22px) scale(0.82);
  color: var(--nx-purple-vivid);
  background: var(--nx-bg-raised);
  padding: 0 5px;
}
.nx-float-label {
  position: absolute;
  left: 12px;
  top: 12px;
  font-size: 13px;
  color: var(--nx-text-muted);
  pointer-events: none;
  transition: all 0.2s var(--nx-ease);
  transform-origin: left;
}

select.nx-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2356566A' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.nx-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--nx-text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

textarea.nx-input {
  resize: none;
  min-height: 80px;
}

/* Override all default focus for consistency */
input:focus, select:focus, textarea:focus {
  border-color: var(--nx-purple) !important;
  box-shadow: 0 0 0 3px var(--nx-purple-glow), var(--nx-shadow-sm) !important;
  outline: none !important;
}

/* ── CARD SYSTEM ────────────────────────────────────────────── */
.nx-card {
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-lg);
  overflow: hidden;
  transition: all var(--nx-duration) var(--nx-ease);
}
.nx-card-hover:hover {
  border-color: rgba(139, 92, 246, 0.12);
  box-shadow: var(--nx-shadow-md), 0 0 0 1px rgba(139, 92, 246, 0.06);
  transform: translateY(-2px);
}
.nx-card-body { padding: 20px; }

/* Card with shine on hover */
.nx-card-shine {
  position: relative;
  overflow: hidden;
}
.nx-card-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
.nx-card-shine:hover::after { opacity: 1; }

/* ── TABLE SYSTEM — Notion/Airtable hybrid ──────────────────── */
.nx-table-wrapper {
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-lg);
  overflow: hidden;
}
.nx-table {
  width: 100%;
  border-collapse: collapse;
}
.nx-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}
.nx-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--nx-text-ghost);
  background: var(--nx-bg-elevated);
  border-bottom: 1px solid var(--nx-border);
  white-space: nowrap;
  user-select: none;
}
.nx-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--nx-border-subtle);
  vertical-align: middle;
  color: var(--nx-text-secondary);
}
.nx-table tbody tr {
  transition: background 0.15s ease;
}
.nx-table tbody tr:hover { background: var(--nx-purple-glow); }
.nx-table tbody tr:last-child td { border-bottom: none; }

/* ── BADGE — pill style ─────────────────────────────────────── */
.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.nx-badge-purple { color: var(--nx-purple-vivid); background: rgba(139,92,246,0.10); border-color: rgba(139,92,246,0.15); }
.nx-badge-blue   { color: #60A5FA; background: rgba(59,130,246,0.10); border-color: rgba(59,130,246,0.15); }
.nx-badge-green  { color: #4ADE80; background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.15); }
.nx-badge-amber  { color: #FCD34D; background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.15); }
.nx-badge-red    { color: #FCA5A5; background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.15); }
.nx-badge-slate  { color: var(--nx-text-muted); background: var(--nx-bg-elevated); border-color: var(--nx-border-strong); }

/* Status dot */
.nx-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nx-dot-live {
  animation: nx-dot-breathe 2.5s ease-in-out infinite;
  box-shadow: 0 0 6px currentColor;
}

/* ── AVATAR ─────────────────────────────────────────────────── */
.nx-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  border-radius: var(--nx-radius-sm);
  background: var(--nx-gradient);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.nx-avatar-sm { width: 30px; height: 30px; font-size: 10px; border-radius: var(--nx-radius-xs); }
.nx-avatar-md { width: 36px; height: 36px; font-size: 12px; }
.nx-avatar-lg { width: 44px; height: 44px; font-size: 14px; }

/* ── STAT CARD ──────────────────────────────────────────────── */
.nx-stat {
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-lg);
  padding: 18px 20px;
  transition: all var(--nx-duration) var(--nx-ease);
  position: relative;
}
.nx-stat:hover {
  border-color: rgba(139, 92, 246, 0.12);
  box-shadow: var(--nx-shadow-md);
  transform: translateY(-2px);
}
.nx-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--nx-text);
  line-height: 1.1;
  margin-bottom: 2px;
  letter-spacing: -0.03em;
}
.nx-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--nx-text-muted);
  letter-spacing: 0.01em;
}

/* ── ALERT / TOAST ──────────────────────────────────────────── */
.nx-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--nx-radius-md);
  font-size: 13px;
  font-weight: 500;
  animation: nx-slide-down 0.4s var(--nx-ease) both;
  border: 1px solid transparent;
}
.nx-alert-error   { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.12); color: #FCA5A5; }
.nx-alert-success { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.12); color: #4ADE80; }
.nx-alert-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.12); color: #FCD34D; }
.nx-alert-info    { background: var(--nx-purple-glow); border-color: rgba(139,92,246,0.12); color: var(--nx-purple-vivid); }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.nx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  background: var(--nx-bg-raised);
  border: 1px dashed var(--nx-border-strong);
  border-radius: var(--nx-radius-lg);
}
.nx-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--nx-radius-lg);
  background: var(--nx-purple-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.nx-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--nx-text);
  margin-bottom: 4px;
}
.nx-empty-desc {
  font-size: 13px;
  color: var(--nx-text-muted);
  margin-bottom: 18px;
  max-width: 300px;
}

/* ── TABS ───────────────────────────────────────────────────── */
.nx-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-lg);
}
.nx-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--nx-text-muted);
  border-radius: var(--nx-radius-md);
  transition: all var(--nx-duration) var(--nx-ease);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}
.nx-tab:hover {
  color: var(--nx-text-secondary);
  background: var(--nx-bg-elevated);
}
.nx-tab.active {
  color: #fff;
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.15);
  box-shadow: 0 0 12px -2px rgba(139, 92, 246, 0.2);
}

/* ── FILTER CHIPS ───────────────────────────────────────────── */
.nx-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid var(--nx-border-strong);
  color: var(--nx-text-muted);
  background: transparent;
  transition: all var(--nx-duration) var(--nx-ease);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.nx-chip:hover {
  color: var(--nx-text-secondary);
  border-color: rgba(139, 92, 246, 0.15);
  background: rgba(139, 92, 246, 0.05);
}
.nx-chip.active {
  color: var(--nx-purple-vivid);
  border-color: rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.08);
}

/* ── DROPDOWN ───────────────────────────────────────────────── */
.nx-dropdown {
  background: var(--nx-bg-elevated);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-md);
  box-shadow: var(--nx-shadow-xl);
  padding: 4px;
  min-width: 200px;
  animation: nx-scale-in 0.2s var(--nx-ease) both;
}
.nx-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--nx-text-secondary);
  border-radius: var(--nx-radius-xs);
  transition: all 0.15s;
  text-decoration: none;
}
.nx-dropdown-item:hover {
  background: var(--nx-purple-glow);
  color: var(--nx-purple-vivid);
}
.nx-dropdown-item-danger:hover {
  background: rgba(239,68,68,0.08);
  color: #FCA5A5;
}

/* ── PAGE HEADER ────────────────────────────────────────────── */
.nx-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.nx-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--nx-text);
  letter-spacing: -0.025em;
}
.nx-page-subtitle {
  font-size: 13px;
  color: var(--nx-text-muted);
  margin-top: 2px;
}

/* ── BACK LINK ──────────────────────────────────────────────── */
.nx-back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--nx-text-muted);
  transition: color 0.2s;
  text-decoration: none;
}
.nx-back-link:hover { color: var(--nx-purple-vivid); }
.nx-back-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s var(--nx-ease);
}
.nx-back-link:hover svg { transform: translateX(-3px); }

/* ── Mobile Overlay ─────────────────────────────────────────── */
.nx-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--nx-overlay-backdrop);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 40;
  animation: nx-fade 0.2s var(--nx-ease);
}

/* ── Spinner ────────────────────────────────────────────────── */
.nx-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--nx-border-strong);
  border-top-color: var(--nx-purple);
  border-radius: 50%;
  animation: nx-spin 0.7s linear infinite;
}

/* ── Tooltip ────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--nx-radius-xs);
  background: var(--nx-bg-overlay);
  border: 1px solid var(--nx-border-strong);
  color: var(--nx-text);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--nx-ease);
  box-shadow: var(--nx-shadow-lg);
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Separator ──────────────────────────────────────────────── */
.nx-separator {
  border: none;
  height: 1px;
  background: var(--nx-border);
  margin: 0;
}

/* ── Iconic hover glow for icon containers ──────────────────── */
.nx-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nx-radius-md);
  transition: all var(--nx-duration) var(--nx-ease);
}
.nx-icon-box-purple {
  background: rgba(139,92,246,0.08);
  color: var(--nx-purple-vivid);
}
.nx-icon-box-blue {
  background: rgba(59,130,246,0.08);
  color: #60A5FA;
}
.nx-icon-box-green {
  background: rgba(34,197,94,0.08);
  color: #4ADE80;
}
.nx-icon-box-amber {
  background: rgba(245,158,11,0.08);
  color: #FCD34D;
}

/* ── Hover lift utility ─────────────────────────────────────── */
.hover-lift {
  transition: all var(--nx-duration) var(--nx-ease);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--nx-shadow-md);
}

/* ── Primary Alias Tokens (maps --nx-primary-* to purple system) */
:root {
  --nx-primary-50:  rgba(139, 92, 246, 0.06);
  --nx-primary-100: rgba(139, 92, 246, 0.10);
  --nx-primary-200: rgba(139, 92, 246, 0.15);
  --nx-primary-300: rgba(139, 92, 246, 0.20);
  --nx-primary-400: var(--nx-purple-vivid);
  --nx-primary-500: var(--nx-purple);
  --nx-primary-600: var(--nx-purple-vivid);
  --nx-primary-700: var(--nx-purple);
  --nx-primary-bg:  rgba(139, 92, 246, 0.08);
}

/* ── MODAL ──────────────────────────────────────────────────── */
.nx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--nx-modal-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: nx-fade 0.2s var(--nx-ease);
}
.nx-modal-backdrop[style*="display: none"] { display: none !important; }

.nx-modal {
  background: var(--nx-bg-elevated);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-xl);
  box-shadow: var(--nx-shadow-xl), 0 0 60px -20px rgba(139, 92, 246, 0.15);
  width: 100%;
  max-width: 480px;
  animation: nx-scale-in 0.25s var(--nx-ease) both;
  overflow: hidden;
}

.nx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--nx-border-subtle);
}

.nx-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--nx-text);
  letter-spacing: -0.02em;
}

.nx-modal-body { padding: 20px 24px; }

.nx-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--nx-border-subtle);
}

/* ── SEARCH INPUT ───────────────────────────────────────────── */
.nx-search-wrap { position: relative; }

.nx-search-wrap .nx-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--nx-text-ghost);
  pointer-events: none;
  flex-shrink: 0;
}

.nx-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  color: var(--nx-text);
  background: var(--nx-bg-raised);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-md);
  outline: none;
  transition: all var(--nx-duration) var(--nx-ease);
  caret-color: var(--nx-purple);
}
.nx-search-input::placeholder { color: var(--nx-text-ghost); }
.nx-search-input:focus {
  border-color: var(--nx-purple) !important;
  box-shadow: 0 0 0 3px var(--nx-purple-glow) !important;
  background: var(--nx-bg-elevated) !important;
  outline: none !important;
}

/* ── FILTER BAR ─────────────────────────────────────────────── */
.nx-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--nx-bg-elevated);
  border-bottom: 1px solid var(--nx-border);
  flex-wrap: wrap;
}

/* ── FORM SECTION ───────────────────────────────────────────── */
.nx-form-section {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--nx-border-subtle);
}
.nx-form-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--nx-text-ghost);
  margin-bottom: 16px;
}

/* ── INPUT VALIDATION STATES ────────────────────────────────── */
.nx-input-error { border-color: rgba(239, 68, 68, 0.4) !important; }
.nx-input-error:focus {
  border-color: var(--nx-danger) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.10) !important;
}
.nx-input-success { border-color: rgba(34, 197, 94, 0.3) !important; }

/* ── FIELD HELPERS ──────────────────────────────────────────── */
.nx-field-hint  { font-size: 11px; color: var(--nx-text-muted); margin-top: 5px; }
.nx-field-error { font-size: 11px; color: #FCA5A5; margin-top: 5px; }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.nx-progress {
  height: 4px;
  background: var(--nx-bg-overlay);
  border-radius: 100px;
  overflow: hidden;
}
.nx-progress-bar {
  height: 100%;
  background: var(--nx-gradient);
  border-radius: 100px;
  transition: width 0.5s var(--nx-ease);
}

/* ── KBD ────────────────────────────────────────────────────── */
.nx-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 600;
  font-family: inherit;
  color: var(--nx-text-ghost);
  background: var(--nx-bg-overlay);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-xs);
}

/* ── GEO / MONO ─────────────────────────────────────────────── */
.nx-geo-coord {
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 11px;
  color: var(--nx-info);
  background: rgba(59, 130, 246, 0.06);
  padding: 2px 7px;
  border-radius: var(--nx-radius-xs);
  border: 1px solid rgba(59, 130, 246, 0.10);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nx-mono {
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* ── DATA LABEL-VALUE PAIRS ─────────────────────────────────── */
.nx-dl { display: grid; gap: 12px; }
.nx-dl-2 { grid-template-columns: repeat(2, 1fr); }
.nx-dl-item { display: grid; gap: 3px; }
.nx-dt {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nx-text-ghost);
}
.nx-dd {
  font-size: 13px;
  font-weight: 500;
  color: var(--nx-text);
}

/* ── SUBMISSION CARD (field data) ───────────────────────────── */
.nx-submission-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--nx-border);
}
.nx-submission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.nx-submission-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nx-submission-meta-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--nx-text-ghost);
}
.nx-submission-meta-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--nx-text-secondary);
}

/* ── DATE INPUT — follows active theme ──────────────────────── */
input[type="date"].nx-input,
input[type="datetime-local"].nx-input,
input[type="time"].nx-input {
  color-scheme: var(--nx-color-scheme);
}

/* ── Button loading state ───────────────────────────────────── */
.nx-btn[data-loading] {
  pointer-events: none;
  opacity: 0.72;
}

/* ── Status icon box (project detail header) ────────────────── */
.nx-status-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--nx-radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nx-status-icon-active  { background: rgba(34,197,94,0.08);  }
.nx-status-icon-completed { background: rgba(59,130,246,0.08); }
.nx-status-icon-paused  { background: rgba(245,158,11,0.08); }
.nx-status-icon-default { background: var(--nx-bg-overlay); }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — COLLAPSIBLE SYSTEM
   ══════════════════════════════════════════════════════════════ */

/* Give the sidebar an explicit CSS width so width can animate */
.nx-sidebar {
  width: 260px;
  transition: transform var(--nx-duration-slow) var(--nx-ease),
              width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Collapsed state: icon-rail only — visible overflow for hover tooltips */
.nx-sidebar-collapsed {
  width: 64px;
  overflow: visible;
}
.nx-sidebar-collapsed .nx-sidebar-header {
  height: 64px;
}
.nx-sidebar-collapsed .nx-sidebar-logo-button {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px;
  padding: 5px;
}
.nx-sidebar-collapsed .nx-sidebar-nav {
  padding: 14px 0;
  overflow: visible;
}

/* ── Labels: text that fades+collapses when sidebar narrows ── */
.nx-sidebar-label {
  transition: opacity 0.18s var(--nx-ease), max-width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
}
.nx-sidebar-collapsed .nx-sidebar-label {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

/* ── Nav links centered in collapsed mode ─────────────────── */
.nx-sidebar-collapsed .nx-sidebar-link {
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 8px;
  padding: 0;
  gap: 0;
  border-radius: 12px;
}
.nx-sidebar-collapsed .nx-sidebar-link svg {
  width: 18px;
  height: 18px;
  color: var(--nx-text-muted) !important;
}
.nx-sidebar-collapsed .nx-sidebar-link:hover {
  background: var(--nx-bg-elevated);
  border-color: var(--nx-border-strong);
}
.nx-sidebar-collapsed .nx-sidebar-link.active {
  background: rgba(var(--brand-rgb), 0.12);
  border-color: rgba(var(--brand-rgb), 0.28);
  box-shadow: 0 8px 22px -14px rgba(var(--brand-rgb), 0.65);
}
.nx-sidebar-collapsed .nx-sidebar-link.active svg {
  color: var(--brand) !important;
  filter: none;
}

/* ── Keyboard shortcut hint pill ─────────────────────────── */
.nx-sidebar-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--nx-radius-xs);
  background: var(--nx-bg-overlay);
  border: 1px solid var(--nx-border);
  color: var(--nx-text-ghost);
  line-height: 1.6;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ── Right-side tooltip on hover when collapsed ──────────── */
.nx-sidebar-collapsed .nx-sidebar-link {
  position: relative;
}
.nx-sidebar-collapsed .nx-sidebar-link::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 12px;
  border-radius: var(--nx-radius-sm);
  background: var(--nx-bg-overlay);
  border: 1px solid var(--nx-border-strong);
  color: var(--nx-text);
  white-space: nowrap;
  z-index: 300;
  box-shadow: var(--nx-shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--nx-ease), transform 0.15s var(--nx-ease);
}
.nx-sidebar-collapsed .nx-sidebar-link:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Active pill still shows in collapsed mode */
.nx-sidebar-collapsed .nx-sidebar-link.active::before {
  left: -10px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 12px rgba(var(--brand-rgb), 0.45);
}

/* ── Section toggle button ────────────────────────────────── */
.nx-sidebar-section-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 12px;
  height: 24px;
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
}
.nx-sidebar-section-toggle:focus-visible {
  outline: 2px solid var(--nx-purple);
  border-radius: var(--nx-radius-xs);
}
/* Hide section header (text + chevron) entirely when collapsed */
.nx-sidebar-collapsed .nx-sidebar-section,
.nx-sidebar-collapsed .nx-sidebar-section-toggle {
  display: none;
}
/* Divider above nested admin links when collapsed */
.nx-sidebar-collapsed [id="nx-admin-section"] {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--nx-border-subtle);
}

/* ── User card avatar centered when collapsed ─────────────── */
.nx-sidebar-collapsed .nx-sidebar-user-card {
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  padding: 0;
  gap: 0;
  border-radius: 12px;
}

.nx-sidebar-collapsed .nx-sidebar-status {
  padding: 10px 0;
}
.nx-sidebar-collapsed .nx-sidebar-status > div {
  width: 40px;
  height: 32px;
  margin: 0 auto;
  padding: 0;
  border-radius: 12px;
  background: transparent;
}
.nx-sidebar-collapsed .nx-sidebar-status .nx-dot {
  width: 7px;
  height: 7px;
}
.nx-sidebar-collapsed .nx-sidebar-footer {
  padding: 10px 0;
}
.nx-sidebar-collapsed .nx-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

/* ── Skip to content link (accessibility) ─────────────────── */
.nx-skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--nx-purple);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--nx-radius-md);
  text-decoration: none;
  transition: top 0.1s;
}
.nx-skip-link:focus { top: 8px; }

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — component-level refinements
   ══════════════════════════════════════════════════════════════ */

/* Smooth theme crossfade for primary surfaces */
body,
.nx-sidebar,
.nx-topbar,
.nx-card,
.nx-btn,
.nx-input,
.nx-dropdown,
.nx-modal,
.nx-stat,
.nx-alert,
.nx-badge,
.nx-chip,
.nx-tab,
.nx-sidebar-link,
.nx-table-wrapper,
.nx-empty {
  transition:
    background-color var(--nx-duration) var(--nx-ease),
    color var(--nx-duration) var(--nx-ease),
    border-color var(--nx-duration) var(--nx-ease),
    box-shadow var(--nx-duration) var(--nx-ease);
}

/* Select arrow — use muted-grey that reads on light bg */
[data-theme="light"] select.nx-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2371717A' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

/* Firefox scrollbar */
[data-theme="light"] html,
[data-theme="light"] body {
  scrollbar-color: var(--nx-scrollbar-thumb) transparent;
}

/* Sidebar & topbar dividers — needs more presence in light mode */
[data-theme="light"] .nx-sidebar {
  border-right-color: rgba(17, 17, 20, 0.08);
  box-shadow: 1px 0 0 rgba(17, 17, 20, 0.02);
}
[data-theme="light"] .nx-topbar {
  border-bottom-color: rgba(17, 17, 20, 0.08);
}

[data-theme="light"] .title-grad {
  background: none;
  -webkit-text-fill-color: #111827;
  color: #111827;
}

/* Sidebar active state — refined for light bg */
[data-theme="light"] .nx-sidebar-link.active {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.20);
  color: #5B21B6;
}
[data-theme="light"] .nx-sidebar-collapsed .nx-sidebar-link {
  color: #71717A;
}
[data-theme="light"] .nx-sidebar-collapsed .nx-sidebar-link:hover {
  background: #F4F4F5;
  border-color: rgba(17, 17, 20, 0.08);
}
[data-theme="light"] .nx-sidebar-collapsed .nx-sidebar-link.active {
  background: rgba(var(--brand-rgb), 0.12);
  border-color: rgba(var(--brand-rgb), 0.30);
}
[data-theme="light"] .nx-sidebar-collapsed .nx-sidebar-user-card {
  background: #F4F4F5 !important;
}
[data-theme="light"] .nx-sidebar-link.active svg {
  color: #6D28D9 !important;
  filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.25));
}
[data-theme="light"] .nx-sidebar-collapsed .nx-sidebar-link.active svg {
  color: var(--brand) !important;
  filter: none;
}
[data-theme="light"] .nx-sidebar-link:hover {
  background: rgba(124, 58, 237, 0.05);
  border-color: rgba(124, 58, 237, 0.12);
  color: #18181B;
}

/* Table row hover — subtler in light */
[data-theme="light"] .nx-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.04);
}

/* Dropdown item hover — readable text */
[data-theme="light"] .nx-dropdown-item:hover {
  background: rgba(124, 58, 237, 0.08);
  color: #6D28D9;
}

/* Tab active — darker text for contrast on light bg */
[data-theme="light"] .nx-tab.active {
  color: #6D28D9;
  background: rgba(124, 58, 237, 0.10);
  border-color: rgba(124, 58, 237, 0.22);
  box-shadow: 0 0 10px -2px rgba(124, 58, 237, 0.15);
}

/* Badges — slightly stronger border/tint for readability */
[data-theme="light"] .nx-badge-purple { color: #6D28D9; background: rgba(124,58,237,0.10); border-color: rgba(124,58,237,0.22); }
[data-theme="light"] .nx-badge-blue   { color: #1D4ED8; background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.20); }
[data-theme="light"] .nx-badge-green  { color: #15803D; background: rgba(22,163,74,0.08); border-color: rgba(22,163,74,0.22); }
[data-theme="light"] .nx-badge-amber  { color: #B45309; background: rgba(217,119,6,0.08); border-color: rgba(217,119,6,0.22); }
[data-theme="light"] .nx-badge-red    { color: #B91C1C; background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.22); }

/* Alerts — darker text for WCAG contrast on light bg */
[data-theme="light"] .nx-alert-error   { color: #B91C1C; background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.18); }
[data-theme="light"] .nx-alert-success { color: #15803D; background: rgba(22,163,74,0.07); border-color: rgba(22,163,74,0.18); }
[data-theme="light"] .nx-alert-warning { color: #B45309; background: rgba(217,119,6,0.07); border-color: rgba(217,119,6,0.18); }
[data-theme="light"] .nx-alert-info    { color: #6D28D9; background: rgba(124,58,237,0.07); border-color: rgba(124,58,237,0.18); }

/* Button secondary — defined edge on light bg */
[data-theme="light"] .nx-btn-secondary {
  color: var(--nx-text);
  background: var(--nx-bg-raised);
  border-color: var(--nx-border-strong);
}
[data-theme="light"] .nx-btn-secondary:hover {
  background: var(--nx-bg-elevated);
  border-color: rgba(124, 58, 237, 0.35);
  color: #6D28D9;
}

/* Button danger — readable tint on light */
[data-theme="light"] .nx-btn-danger { color: #B91C1C; background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.20); }
[data-theme="light"] .nx-btn-danger:hover { color: #991B1B; background: rgba(220,38,38,0.12); border-color: rgba(220,38,38,0.30); }

/* KBD — visible on light */
[data-theme="light"] .nx-kbd {
  color: var(--nx-text-muted);
  background: var(--nx-bg-elevated);
  border-color: var(--nx-border-strong);
}

/* Float label bg so the crossed-out portion hides the border */
[data-theme="light"] .nx-field .nx-input:not(:placeholder-shown) + .nx-float-label,
[data-theme="light"] .nx-field .nx-input:focus + .nx-float-label {
  color: #6D28D9;
  background: var(--nx-bg-raised);
}

/* Input hover — avoid purple tint washing out the border */
[data-theme="light"] .nx-input:hover {
  border-color: rgba(124, 58, 237, 0.25);
}

/* Geo coord chip */
[data-theme="light"] .nx-geo-coord {
  color: #1D4ED8;
  background: rgba(37, 99, 235, 0.06);
  border-color: rgba(37, 99, 235, 0.18);
}

/* Sidebar shortcut pill — readable */
[data-theme="light"] .nx-sidebar-shortcut {
  background: var(--nx-bg-elevated);
  color: var(--nx-text-muted);
  border-color: var(--nx-border-strong);
}

/* Tooltip when collapsed */
[data-theme="light"] .nx-sidebar-collapsed .nx-sidebar-link::after {
  background: #18181B;
  color: #FAFAFA;
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: var(--nx-shadow-lg);
}

/* Tooltip [data-tooltip] */
[data-theme="light"] [data-tooltip]::after {
  background: #18181B;
  color: #FAFAFA;
  border-color: rgba(0, 0, 0, 0.2);
}

/* Theme toggle button visual */
.nx-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--nx-radius-md);
  border: 1px solid var(--nx-border-strong);
  background: var(--nx-bg-raised);
  color: var(--nx-text-secondary);
  cursor: pointer;
  transition: all var(--nx-duration) var(--nx-ease);
  flex-shrink: 0;
}
.nx-theme-toggle:hover {
  color: var(--nx-text);
  background: var(--nx-bg-elevated);
  border-color: rgba(139, 92, 246, 0.25);
}
.nx-theme-toggle:focus-visible {
  outline: 2px solid var(--nx-purple);
  outline-offset: 2px;
}
.nx-theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--nx-duration) var(--nx-ease-spring), opacity var(--nx-duration) var(--nx-ease);
}
[data-theme="dark"] .nx-theme-icon-moon,
[data-theme="light"] .nx-theme-icon-sun {
  display: none;
}
.nx-user-menu [data-nx-user-menu-chevron] {
  transition: transform 0.2s var(--nx-ease);
}
.nx-user-menu.is-open [data-nx-user-menu-chevron] {
  transform: rotate(180deg);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   NEXORA - Industrial Premium UI
   Solid B2B surfaces, high contrast, field-readable density.
   ============================================================ */

:root {
  --nx-void: #020617;
  --nx-bg: #0F172A;
  --nx-bg-subtle: #111827;
  --nx-bg-raised: #1E293B;
  --nx-bg-elevated: #243247;
  --nx-bg-overlay: #334155;
  --nx-surface-solid: #111827;
  --nx-surface-panel: #1E293B;
  --nx-surface-panel-2: #263449;
  --nx-border: rgba(148, 163, 184, 0.18);
  --nx-border-subtle: rgba(148, 163, 184, 0.12);
  --nx-border-strong: rgba(148, 163, 184, 0.28);
  --nx-text: #F8FAFC;
  --nx-text-secondary: #CBD5E1;
  --nx-text-muted: #94A3B8;
  --nx-text-ghost: #64748B;
  --nx-purple: #4F46E5;
  --nx-purple-dim: #4338CA;
  --nx-purple-vivid: #818CF8;
  --nx-purple-glow: rgba(79, 70, 229, 0.14);
  --nx-purple-glow-strong: rgba(79, 70, 229, 0.22);
  --nx-gradient: #4F46E5;
  --nx-gradient-vivid: #4F46E5;
  --nx-success: #22C55E;
  --nx-warning: #F59E0B;
  --nx-danger: #EF4444;
  --nx-info: #2563EB;
  --nx-shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.40);
  --nx-shadow-md: 0 8px 18px -14px rgba(2, 6, 23, 0.92);
  --nx-shadow-lg: 0 18px 36px -26px rgba(2, 6, 23, 0.96);
  --nx-shadow-xl: 0 24px 48px -30px rgba(2, 6, 23, 1);
  --nx-shadow-glow: 0 10px 24px -18px rgba(79, 70, 229, 0.75);
  --nx-shadow-glow-strong: 0 12px 28px -18px rgba(79, 70, 229, 0.85);
  --nx-sidebar-bg: #0B1220;
  --nx-topbar-bg: #111827;
  --nx-glass-bg: rgba(255, 255, 255, 0.05);
  --nx-scrollbar-thumb: rgba(148, 163, 184, 0.28);
  --nx-scrollbar-thumb-hover: rgba(148, 163, 184, 0.46);
  --nx-modal-backdrop: rgba(2, 6, 23, 0.74);
  --nx-overlay-backdrop: rgba(2, 6, 23, 0.78);
  --nx-ambient-glow: transparent;
  --nx-color-scheme: dark;
}

[data-theme="light"] {
  --nx-void: #F8FAFC;
  --nx-bg: #F8FAFC;
  --nx-bg-subtle: #F1F5F9;
  --nx-bg-raised: #FFFFFF;
  --nx-bg-elevated: #F8FAFC;
  --nx-bg-overlay: #E2E8F0;
  --nx-surface-solid: #FFFFFF;
  --nx-surface-panel: #F8FAFC;
  --nx-surface-panel-2: #F1F5F9;
  --nx-border: rgba(15, 23, 42, 0.10);
  --nx-border-subtle: rgba(15, 23, 42, 0.08);
  --nx-border-strong: rgba(15, 23, 42, 0.16);
  --nx-text: #0F172A;
  --nx-text-secondary: #334155;
  --nx-text-muted: #475569;
  --nx-text-ghost: #64748B;
  --nx-sidebar-bg: #FFFFFF;
  --nx-topbar-bg: #FFFFFF;
  --nx-purple-vivid: #4F46E5;
  --nx-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --nx-shadow-md: 0 10px 24px -20px rgba(15, 23, 42, 0.35);
  --nx-shadow-lg: 0 18px 36px -28px rgba(15, 23, 42, 0.38);
  --nx-color-scheme: light;
}

body {
  background: var(--nx-bg) !important;
  color: var(--nx-text);
  letter-spacing: 0;
}

.nx-shell-backdrop {
  background:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    var(--nx-bg);
  background-size: 48px 48px, 48px 48px, auto;
}

[data-theme="light"] .nx-shell-backdrop {
  background:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    var(--nx-bg);
  background-size: 48px 48px, 48px 48px, auto;
}

.title-grad,
[data-theme="light"] .title-grad {
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
  color: var(--nx-text) !important;
}

.nx-gradient-bg,
.nx-btn-primary {
  background: var(--brand, var(--nx-purple)) !important;
}

.nx-card,
.nx-card-surface,
.nx-stat,
.nx-table-wrapper,
.nx-empty,
.nx-dashboard-card,
.nx-kpi-card {
  background: var(--nx-surface-solid) !important;
  border: 1px solid var(--nx-border) !important;
  box-shadow: var(--nx-shadow-md) !important;
}

.nx-card-hover:hover,
.nx-dashboard-card:hover,
.nx-kpi-card:hover {
  border-color: var(--nx-border-strong) !important;
  transform: translateY(-1px);
  box-shadow: var(--nx-shadow-lg) !important;
}

.nx-card-shine::after,
.kpi-card::after,
.nx-sidebar::before {
  display: none !important;
}

.kpi-card::before {
  background: var(--brand, var(--nx-purple)) !important;
  opacity: 0.75 !important;
}

.nx-sidebar {
  background: var(--nx-sidebar-bg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-right: 1px solid var(--nx-border) !important;
  box-shadow: 8px 0 24px -24px rgba(2, 6, 23, 1);
}

.nx-sidebar-header,
.nx-sidebar-status,
.nx-sidebar-footer {
  border-color: var(--nx-border) !important;
}

.nx-sidebar-link {
  color: #CBD5E1;
  border-radius: 8px;
}

.nx-sidebar-link:hover {
  background: #1E293B !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
  color: #FFFFFF !important;
}

.nx-sidebar-link.active {
  background: #243247 !important;
  border-color: rgba(var(--brand-rgb, 79, 70, 229), 0.44) !important;
  color: #FFFFFF !important;
}

.nx-sidebar-link.active::before {
  background: var(--brand, var(--nx-purple)) !important;
  box-shadow: none !important;
  animation: none !important;
}

.nx-sidebar-link.active svg,
.nx-sidebar-link:hover svg {
  filter: none !important;
}

.nx-sidebar-logo-button {
  background: var(--brand, var(--nx-purple)) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: none !important;
}

.nx-sidebar-user-card {
  background: #111827 !important;
  border: 1px solid var(--nx-border-subtle);
}

.nx-sidebar-user-card:hover {
  background: #1E293B !important;
}

[data-theme="light"] .nx-sidebar {
  background: var(--nx-sidebar-bg) !important;
  border-right-color: var(--nx-border) !important;
  box-shadow: 8px 0 24px -24px rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .nx-sidebar-link {
  color: #334155 !important;
}

[data-theme="light"] .nx-sidebar-link:hover {
  background: #F1F5F9 !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
  color: #0F172A !important;
}

[data-theme="light"] .nx-sidebar-link.active {
  background: #EEF2FF !important;
  border-color: rgba(var(--brand-rgb, 79, 70, 229), 0.28) !important;
  color: #312E81 !important;
}

[data-theme="light"] .nx-sidebar-user-card {
  background: #F8FAFC !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] .nx-sidebar-user-card:hover {
  background: #F1F5F9 !important;
}

[data-theme="light"] .nx-sidebar-shortcut {
  background: #F1F5F9 !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
  color: #64748B !important;
}

.nx-sidebar.nx-sidebar-collapsed {
  width: 68px !important;
  min-width: 68px !important;
  max-width: 68px !important;
  overflow: visible !important;
}

.nx-sidebar-collapsed .nx-sidebar-header,
.nx-sidebar-collapsed .nx-sidebar-status,
.nx-sidebar-collapsed .nx-sidebar-footer {
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.nx-sidebar-collapsed .nx-sidebar-header {
  height: 68px !important;
}

.nx-sidebar-collapsed .nx-sidebar-nav {
  width: 100% !important;
  padding: 12px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  overflow-x: visible !important;
}

.nx-sidebar-collapsed .nx-sidebar-link,
.nx-sidebar-collapsed .nx-sidebar-logo-button,
.nx-sidebar-collapsed .nx-sidebar-status > div,
.nx-sidebar-collapsed .nx-sidebar-user-card {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  flex: 0 0 42px !important;
  gap: 0 !important;
}

.nx-sidebar-collapsed .nx-sidebar-link {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  border-radius: 13px !important;
}

.nx-sidebar-collapsed .nx-sidebar-logo-button {
  border-radius: 12px !important;
}

.nx-sidebar-collapsed .nx-sidebar-link svg,
.nx-sidebar-collapsed .nx-sidebar-logo-button svg {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
}

.nx-sidebar-collapsed .nx-sidebar-logo-image {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.nx-sidebar-collapsed .nx-sidebar-link.active::before {
  left: -7px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.nx-sidebar-collapsed .nx-sidebar-status > div {
  background: transparent !important;
}

.nx-sidebar-collapsed .nx-avatar-sm {
  width: 32px !important;
  height: 32px !important;
}

.nx-topbar {
  background: var(--nx-topbar-bg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid var(--nx-border) !important;
  box-shadow: 0 8px 24px -28px rgba(2, 6, 23, 1);
}

.nx-topbar-search-input,
.nx-input,
select.nx-input,
textarea.nx-input {
  background: var(--nx-surface-panel) !important;
  border: 1px solid var(--nx-border-strong) !important;
  color: var(--nx-text) !important;
  box-shadow: none !important;
}

.nx-topbar-search-input:focus,
.nx-input:focus {
  background: var(--nx-surface-panel-2) !important;
  border-color: var(--brand, var(--nx-purple)) !important;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb, 79, 70, 229), 0.22) !important;
}

.nx-btn {
  border-radius: 8px;
  box-shadow: none !important;
}

.nx-btn-primary {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.nx-btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.nx-btn-secondary,
.nx-theme-toggle {
  background: var(--nx-surface-panel) !important;
  border-color: var(--nx-border-strong) !important;
  color: var(--nx-text-secondary) !important;
}

.nx-btn-secondary:hover,
.nx-theme-toggle:hover {
  background: var(--nx-surface-panel-2) !important;
  color: var(--nx-text) !important;
}

.nx-dropdown,
.nx-search-menu {
  background: var(--nx-surface-solid) !important;
  border: 1px solid var(--nx-border-strong) !important;
  box-shadow: var(--nx-shadow-lg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.nx-table {
  background: var(--nx-surface-solid);
}

.nx-table thead {
  background: var(--nx-bg-subtle) !important;
}

.nx-table tbody tr:hover {
  background: var(--nx-surface-panel) !important;
}

.nx-modal-backdrop {
  background: var(--nx-modal-backdrop) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

.nx-modal {
  background: rgba(15, 23, 42, 0.96) !important;
  border: 1px solid var(--nx-border-strong) !important;
  box-shadow: var(--nx-shadow-xl) !important;
}

.nx-page-header {
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}

.nx-page-title {
  color: var(--nx-text) !important;
  letter-spacing: 0;
}

.nx-icon-box,
.nx-status-icon {
  background: var(--nx-surface-panel-2) !important;
  border: 1px solid var(--nx-border) !important;
  box-shadow: none !important;
}

.nx-alert {
  background: var(--nx-surface-panel) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: var(--nx-border-strong) !important;
}

@media (max-width: 768px) {
  .nx-topbar {
    padding: 0 14px;
  }

  .nx-content-wrap {
    padding-left: 14px;
    padding-right: 14px;
  }

  .nx-card-body {
    padding: 16px;
  }

  .nx-page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Final collapsed rail normalization. Keep every sidebar control on one axis. */
#sidebar.nx-sidebar-collapsed {
  --nx-rail-width: 64px;
  --nx-rail-item: 40px;
  width: var(--nx-rail-width) !important;
  min-width: var(--nx-rail-width) !important;
  max-width: var(--nx-rail-width) !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-rows: 64px minmax(0, 1fr) 64px 64px !important;
  align-items: stretch !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-header,
#sidebar.nx-sidebar-collapsed .nx-sidebar-nav,
#sidebar.nx-sidebar-collapsed .nx-sidebar-status,
#sidebar.nx-sidebar-collapsed .nx-sidebar-footer {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-header,
#sidebar.nx-sidebar-collapsed .nx-sidebar-status,
#sidebar.nx-sidebar-collapsed .nx-sidebar-footer {
  display: grid !important;
  place-items: center !important;
  min-height: 0 !important;
  flex: none !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-nav {
  display: grid !important;
  justify-items: center !important;
  align-content: start !important;
  grid-auto-rows: max-content !important;
  row-gap: 10px !important;
  padding-top: 10px !important;
  padding-bottom: 12px !important;
  min-height: 0 !important;
  flex: none !important;
  overflow-y: auto !important;
  overflow-x: visible !important;
  scrollbar-width: none !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-nav::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-nav > :not([hidden]) ~ :not([hidden]),
#sidebar.nx-sidebar-collapsed #nx-admin-section > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-admin,
#sidebar.nx-sidebar-collapsed .nx-sidebar-admin-links,
#sidebar.nx-sidebar-collapsed #nx-admin-section {
  box-sizing: border-box !important;
  width: 100% !important;
  display: grid !important;
  justify-items: center !important;
  row-gap: 8px !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-admin {
  padding-top: 12px !important;
  margin-top: 0 !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-admin-links,
#sidebar.nx-sidebar-collapsed #nx-admin-section {
  padding-top: 12px !important;
  margin-top: 0 !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-link,
#sidebar.nx-sidebar-collapsed .nx-sidebar-logo-button,
#sidebar.nx-sidebar-collapsed .nx-sidebar-status > div,
#sidebar.nx-sidebar-collapsed .nx-sidebar-user-card {
  box-sizing: border-box !important;
  width: var(--nx-rail-item) !important;
  min-width: var(--nx-rail-item) !important;
  max-width: var(--nx-rail-item) !important;
  height: var(--nx-rail-item) !important;
  min-height: var(--nx-rail-item) !important;
  max-height: var(--nx-rail-item) !important;
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  transform: none !important;
  border-radius: 12px !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-link.active::before {
  display: none !important;
}

#sidebar.nx-sidebar-collapsed .nx-sidebar-link svg {
  position: static !important;
  display: block !important;
  flex: none !important;
}

#sidebar.nx-sidebar-collapsed .nx-dot {
  display: block !important;
  margin: 0 !important;
}

#sidebar.nx-sidebar-collapsed::after {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  top: 64px !important;
  bottom: 0 !important;
  width: 7px !important;
  display: block !important;
  background: var(--nx-sidebar-bg) !important;
  z-index: 250 !important;
  pointer-events: none !important;
}

#sidebar .nx-sidebar-link::before,
#sidebar .nx-sidebar-link.active::before,
#sidebar.nx-sidebar-collapsed .nx-sidebar-link::before,
#sidebar.nx-sidebar-collapsed .nx-sidebar-link.active::before {
  content: none !important;
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
