/* ═══════════════════════════════════════════════════════════════
   NEXUS COMPONENT LIBRARY — nexus_components.css
   Design Authority: SNT_DESIGN
   Version: 1.0 | 2026-04-08
   Theme: Dark-Medium Blend (V3 FINAL)

   ALL tab builders MUST import this file.
   ZERO custom styles invented outside this library.
   ═══════════════════════════════════════════════════════════════ */

/* ─── GOOGLE FONTS ─── */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ─── ROOT VARIABLES (V3 Dark-Medium Palette) ─── */
:root {
  /* Backgrounds */
  --bg: #1a1f2e;
  --bg-secondary: #151a27;
  --surface: #242b3d;
  --surface-hover: #2d3548;
  --border: #333d52;

  /* Text */
  --text: #d4d8e0;
  --text-secondary: #8b95a8;
  --text-muted: #5f6b80;

  /* Accent */
  --accent: #c5a556;
  --accent-hover: #d4b66a;
  --accent-dim: #9e8444;

  /* Status */
  --success: #3ecf8e;
  --error: #f87171;
  --warning: #f0883e;
  --info: #60a5fa;

  /* Nav */
  --nav-bg: #151a27;
  --nav-active: #c5a556;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Typography */
  --font-heading: 'Bebas Neue', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;

  /* Z-index layers */
  --z-dropdown: 100;
  --z-modal-backdrop: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-command-palette: 500;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── TYPOGRAPHY ─── */
.nx-heading-xl {
  font-family: var(--font-heading);
  font-size: 36px;
  letter-spacing: 1px;
  color: var(--text);
  line-height: 1.2;
}

.nx-heading-lg {
  font-family: var(--font-heading);
  font-size: 28px;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1.3;
}

.nx-heading-md {
  font-family: var(--font-heading);
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1.4;
}

.nx-heading-sm {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.nx-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nx-data {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.nx-data-sm {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text);
}

.nx-muted {
  color: var(--text-muted);
  font-size: 14px;
}

.nx-timestamp {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── LAYOUT ─── */
.nx-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.nx-grid {
  display: grid;
  gap: var(--space-md);
}

.nx-grid-2 { grid-template-columns: repeat(2, 1fr); }
.nx-grid-3 { grid-template-columns: repeat(3, 1fr); }
.nx-grid-4 { grid-template-columns: repeat(4, 1fr); }

.nx-flex {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nx-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nx-flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nx-gap-sm { gap: var(--space-sm); }
.nx-gap-md { gap: var(--space-md); }
.nx-gap-lg { gap: var(--space-lg); }

/* ─── CARD ─── */
.nx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.nx-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.nx-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.nx-card-compact {
  padding: var(--space-md);
}

.nx-card-highlight {
  border-left: 3px solid var(--accent);
}

/* Metric card */
.nx-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: default;
}

.nx-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  border-color: var(--accent-dim);
}

.nx-metric-card .nx-metric-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.nx-metric-card .nx-metric-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: var(--space-xs);
}

/* ─── BUTTONS ─── */
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  white-space: nowrap;
}

.nx-btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.nx-btn-primary:hover {
  background: var(--accent-hover);
}

.nx-btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.nx-btn-outline:hover {
  background: var(--accent);
  color: var(--bg);
}

.nx-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.nx-btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nx-btn-danger {
  background: var(--error);
  color: #fff;
}
.nx-btn-danger:hover {
  background: #ef4444;
}

.nx-btn-success {
  background: var(--success);
  color: var(--bg);
}
.nx-btn-success:hover {
  background: #34d399;
}

.nx-btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  min-height: 36px;
}

.nx-btn-lg {
  padding: 16px 32px;
  font-size: 18px;
}

.nx-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Icon button */
.nx-btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
}
.nx-btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Floating action button */
.nx-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg);
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.nx-fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* ─── BADGES ─── */
.nx-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.nx-badge-success {
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
}

.nx-badge-warning {
  background: rgba(240, 136, 62, 0.15);
  color: var(--warning);
}

.nx-badge-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

.nx-badge-info {
  background: rgba(96, 165, 250, 0.15);
  color: var(--info);
}

.nx-badge-accent {
  background: rgba(197, 165, 86, 0.15);
  color: var(--accent);
}

.nx-badge-muted {
  background: rgba(95, 107, 128, 0.15);
  color: var(--text-muted);
}

/* ─── PILLS (tags, topic hashes) ─── */
.nx-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: default;
  min-height: 32px;
}

.nx-pill-active {
  background: rgba(197, 165, 86, 0.15);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.nx-pill-dismiss {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
  margin-left: 4px;
}
.nx-pill-dismiss:hover {
  opacity: 1;
  color: var(--error);
}

/* ─── STATUS DOT ─── */
.nx-status-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

.nx-status-dot-success { background: var(--success); }
.nx-status-dot-warning { background: var(--warning); }
.nx-status-dot-error { background: var(--error); }
.nx-status-dot-info { background: var(--info); }
.nx-status-dot-muted { background: var(--text-muted); }

/* Pulse animation for active/live */
.nx-status-dot-pulse {
  animation: nx-pulse 2s ease-in-out infinite;
}

@keyframes nx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── TABLE ─── */
.nx-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.nx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.nx-table th {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.nx-table th:hover {
  color: var(--text);
}

.nx-table th .nx-sort-icon {
  margin-left: 4px;
  opacity: 0.3;
}

.nx-table th.nx-sorted .nx-sort-icon {
  opacity: 1;
  color: var(--accent);
}

.nx-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.nx-table tbody tr {
  transition: background 0.1s ease;
}

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

.nx-table tbody tr:last-child td {
  border-bottom: none;
}

/* Compact variant */
.nx-table-compact th,
.nx-table-compact td {
  padding: 10px 12px;
  font-size: 15px;
}

/* ─── FORM ELEMENTS ─── */
.nx-input,
.nx-select,
.nx-textarea {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  width: 100%;
  min-height: 44px;
  transition: border-color 0.15s ease;
  outline: none;
}

.nx-input:focus,
.nx-select:focus,
.nx-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(197, 165, 86, 0.2);
}

.nx-input::placeholder {
  color: var(--text-muted);
}

.nx-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.nx-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b95a8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Search input with icon */
.nx-search-wrapper {
  position: relative;
}

.nx-search-wrapper .nx-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.nx-search-wrapper .nx-input {
  padding-left: 44px;
}

/* Checkbox / toggle */
.nx-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s ease;
}

.nx-toggle.active {
  background: var(--accent);
}

.nx-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: var(--radius-full);
  transition: transform 0.2s ease;
}

.nx-toggle.active::after {
  transform: translateX(22px);
}

/* Form group */
.nx-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.nx-form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── TAB BAR ─── */
.nx-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nx-tab-bar::-webkit-scrollbar {
  display: none;
}

.nx-tab-item {
  font-family: var(--font-heading);
  font-size: 18px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 14px 20px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nx-tab-item:hover {
  color: var(--text);
}

.nx-tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nx-tab-item .nx-tab-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(197, 165, 86, 0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Sub-tab pills (status filters) */
.nx-pill-tabs {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.nx-pill-tab {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.nx-pill-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nx-pill-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ─── TOP NAVIGATION (main app nav) ─── */
.nx-nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.nx-nav-logo {
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--accent);
  margin-right: var(--space-xl);
  flex-shrink: 0;
}

.nx-nav-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.nx-nav-tabs::-webkit-scrollbar {
  display: none;
}

.nx-nav-tab {
  font-family: var(--font-heading);
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nx-nav-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.nx-nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nx-nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 12px;
  display: flex;
  align-items: center;
  opacity: 0.5;
}

/* ─── MODAL ─── */
.nx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.nx-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.nx-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.nx-modal-backdrop.active .nx-modal {
  transform: translateY(0);
}

.nx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.nx-modal-title {
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--text);
}

.nx-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nx-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nx-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ─── TOAST NOTIFICATIONS ─── */
.nx-toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.nx-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  font-size: 16px;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 300px;
  max-width: 450px;
  pointer-events: auto;
  animation: nx-toast-in 0.3s ease;
}

.nx-toast-success { border-left: 3px solid var(--success); }
.nx-toast-error { border-left: 3px solid var(--error); }
.nx-toast-warning { border-left: 3px solid var(--warning); }
.nx-toast-info { border-left: 3px solid var(--info); }

.nx-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.nx-toast-success .nx-toast-icon { color: var(--success); }
.nx-toast-error .nx-toast-icon { color: var(--error); }
.nx-toast-warning .nx-toast-icon { color: var(--warning); }
.nx-toast-info .nx-toast-icon { color: var(--info); }

@keyframes nx-toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes nx-toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ─── EMPTY STATE ─── */
.nx-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
  color: var(--text-muted);
}

.nx-empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.nx-empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.nx-empty-state-msg {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 400px;
}

/* ─── SKELETON LOADING ─── */
.nx-skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: nx-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.nx-skeleton-text {
  height: 16px;
  margin-bottom: var(--space-sm);
}

.nx-skeleton-heading {
  height: 28px;
  width: 60%;
  margin-bottom: var(--space-md);
}

.nx-skeleton-card {
  height: 120px;
}

@keyframes nx-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ─── TIMELINE ─── */
.nx-timeline {
  position: relative;
  padding-left: 28px;
}

.nx-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.nx-timeline-item {
  position: relative;
  padding-bottom: var(--space-lg);
}

.nx-timeline-dot {
  position: absolute;
  left: -24px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--accent);
  border: 2px solid var(--bg);
}

.nx-timeline-item .nx-timestamp {
  margin-bottom: var(--space-xs);
}

/* ─── DROPDOWN ─── */
.nx-dropdown {
  position: relative;
  display: inline-block;
}

.nx-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: var(--space-xs) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.15s ease;
}

.nx-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nx-dropdown-item {
  padding: 10px 16px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nx-dropdown-item:hover {
  background: var(--surface-hover);
}

.nx-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xs) 0;
}

/* ─── PROGRESS BAR ─── */
.nx-progress {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.nx-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.3s ease;
}

.nx-progress-bar-success { background: var(--success); }
.nx-progress-bar-warning { background: var(--warning); }
.nx-progress-bar-error { background: var(--error); }

/* ─── COMMAND PALETTE ─── */
.nx-command-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-command-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
}

.nx-command-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.nx-command-palette {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 600px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.nx-command-input {
  font-family: var(--font-body);
  font-size: 20px;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 20px 24px;
  width: 100%;
  outline: none;
  border-bottom: 1px solid var(--border);
}

.nx-command-results {
  max-height: 400px;
  overflow-y: auto;
}

.nx-command-item {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: background 0.1s ease;
}

.nx-command-item:hover,
.nx-command-item.selected {
  background: var(--surface-hover);
}

.nx-command-item-label {
  font-size: 16px;
  color: var(--text);
}

.nx-command-item-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ─── MOBILE BOTTOM NAV ─── */
.nx-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  height: 60px;
  z-index: 90;
  padding: 0 var(--space-sm);
}

.nx-mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.nx-mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 8px;
  min-width: 56px;
  cursor: pointer;
}

.nx-mobile-nav-item.active {
  color: var(--accent);
}

.nx-mobile-nav-item-icon {
  font-size: 20px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .nx-page {
    padding: var(--space-md);
    padding-bottom: 80px; /* room for mobile nav */
  }

  .nx-grid-2,
  .nx-grid-3,
  .nx-grid-4 {
    grid-template-columns: 1fr;
  }

  .nx-nav {
    display: none; /* replaced by mobile nav */
  }

  .nx-mobile-nav {
    display: block;
  }

  .nx-modal {
    max-width: 100%;
    margin: var(--space-md);
    max-height: 90vh;
  }

  .nx-toast-container {
    top: auto;
    bottom: 72px;
    right: var(--space-md);
    left: var(--space-md);
  }

  .nx-toast {
    min-width: auto;
    max-width: 100%;
  }

  .nx-card {
    padding: var(--space-md);
  }

  .nx-metric-card .nx-metric-value {
    font-size: 24px;
  }

  .nx-fab {
    bottom: 80px; /* above mobile nav */
  }

  .nx-command-palette {
    width: 100%;
    margin: 0 var(--space-md);
  }

  /* 2x2 grid for metric cards on mobile */
  .nx-grid-metrics-mobile {
    grid-template-columns: repeat(2, 1fr);
  }

  .nx-table-wrapper {
    font-size: 14px;
  }

  .nx-heading-xl { font-size: 28px; }
  .nx-heading-lg { font-size: 22px; }
}

/* ─── UTILITY CLASSES ─── */
.nx-text-success { color: var(--success); }
.nx-text-error { color: var(--error); }
.nx-text-warning { color: var(--warning); }
.nx-text-info { color: var(--info); }
.nx-text-accent { color: var(--accent); }
.nx-text-muted { color: var(--text-muted); }

.nx-bg-success { background: rgba(62, 207, 142, 0.1); }
.nx-bg-error { background: rgba(248, 113, 113, 0.1); }
.nx-bg-warning { background: rgba(240, 136, 62, 0.1); }

.nx-border-success { border-color: var(--success); }
.nx-border-error { border-color: var(--error); }
.nx-border-warning { border-color: var(--warning); }

.nx-mt-sm { margin-top: var(--space-sm); }
.nx-mt-md { margin-top: var(--space-md); }
.nx-mt-lg { margin-top: var(--space-lg); }
.nx-mb-sm { margin-bottom: var(--space-sm); }
.nx-mb-md { margin-bottom: var(--space-md); }
.nx-mb-lg { margin-bottom: var(--space-lg); }

.nx-hidden { display: none !important; }
.nx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.nx-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-text-center { text-align: center; }
.nx-text-right { text-align: right; }
.nx-w-full { width: 100%; }
