/* ==========================================================================
   VERITAS INTELLIGENCE — ULTRA-PREMIUM DESIGN SYSTEM (ENTERPRISE v4.0)
   Aesthetic: Palantir Foundry / Linear / Bloomberg Institutional Dark UI
   Typography: Plus Jakarta Sans (Display/UI) + IBM Plex Mono (Forensic Data)
   ========================================================================== */

:root {
  /* Deep Obsidian & Carbon Slate Surfaces */
  --bg-void: #03060c;
  --bg-canvas: #060a12;
  --bg-surface-1: #0a101d;
  --bg-surface-2: #0f172a;
  --bg-surface-3: #162038;
  --bg-surface-hover: #1b2845;

  /* Precision Hairline Borders & Specular Refraction */
  --border-subtle: rgba(148, 163, 184, 0.08);
  --border-default: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.25);
  --border-accent: rgba(59, 130, 246, 0.55);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Semantic Risk Tokens */
  --accent-primary: #2563eb;
  --accent-primary-hover: #3b82f6;
  --accent-primary-soft: rgba(37, 99, 235, 0.15);

  --risk-critical: #f43f5e;
  --risk-critical-bg: rgba(244, 63, 94, 0.12);
  --risk-critical-border: rgba(244, 63, 94, 0.35);

  --risk-high: #f59e0b;
  --risk-high-bg: rgba(245, 158, 11, 0.12);
  --risk-high-border: rgba(245, 158, 11, 0.35);

  --risk-low: #10b981;
  --risk-low-bg: rgba(16, 185, 129, 0.12);
  --risk-low-border: rgba(16, 185, 129, 0.35);

  /* Institutional Typography Stack */
  --font-sans: 'Plus Jakarta Sans', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans) !important;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: -0.008em;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}

h1, h2, h3, h4, .font-extrabold, .font-bold {
  font-family: var(--font-sans);
  letter-spacing: -0.022em;
}

.font-mono, code, pre, .tabular-nums {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: -0.01em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 10, 18, 0.6);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Technical Grid & Matrix Backgrounds */
.bg-tech-grid {
  background-color: var(--bg-void);
  background-image: 
    linear-gradient(to right, rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

.bg-dot-matrix {
  background-color: #050912;
  background-image: 
    radial-gradient(rgba(59, 130, 246, 0.12) 1px, transparent 1px),
    radial-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* Ultra-Premium Panels & Cards with Top Light Refraction */
.nx-panel {
  background: linear-gradient(180deg, rgba(16, 24, 42, 0.92) 0%, rgba(10, 16, 29, 0.96) 100%);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 
    0 8px 24px -4px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  position: relative;
}

.nx-card {
  background: linear-gradient(180deg, rgba(20, 30, 52, 0.78) 0%, rgba(12, 19, 34, 0.88) 100%);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.nx-card:hover {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(25, 37, 64, 0.85) 0%, rgba(15, 23, 42, 0.92) 100%);
  box-shadow: 
    0 6px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
}

/* Ambient Risk Glows for Ultra-Premium Cards */
.nx-glow-critical {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(244, 63, 94, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(244, 63, 94, 0.28);
}
.nx-glow-critical:hover {
  border-color: rgba(244, 63, 94, 0.5);
}

.nx-glow-amber {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(245, 158, 11, 0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(245, 158, 11, 0.28);
}
.nx-glow-amber:hover {
  border-color: rgba(245, 158, 11, 0.5);
}

.nx-glow-blue {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(59, 130, 246, 0.11) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(59, 130, 246, 0.28);
}

.nx-glow-emerald {
  background: 
    radial-gradient(140% 100% at 100% 0%, rgba(16, 185, 129, 0.09) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border-color: rgba(16, 185, 129, 0.26);
}

/* Evidence Data Pill inside Forensic Cards */
.nx-data-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(6, 10, 18, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
}

/* Screen Transition Architecture (Full Viewport Fill, Zero Dead Bottom Space) */
.nx-screen {
  display: none !important;
}

.nx-screen.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 100%;
  width: 100%;
  animation: nxScreenFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nxScreenFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Module Tab Content Transitions */
.nx-module-pane {
  display: none !important;
}

.nx-module-pane.active {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  animation: nxScreenFadeIn 0.15s ease-out forwards;
}

/* Sidebar Navigation Links */
.nx-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6.5px 10px;
  border-radius: 6px;
  font-size: 11.75px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: left;
  white-space: nowrap;
}

.nx-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nx-nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0.06) 100%);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: inset 2px 0 0 #3b82f6;
  font-weight: 600;
}

.nx-nav-item.active .nx-nav-code {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.25);
}

.nx-nav-code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Sub-navigation Segmented Module Bar (Full Width Distributed) */
.nx-module-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 7px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  border-right: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.nx-module-tab:last-child {
  border-right: none;
}

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

.nx-module-tab.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.04) 0%, rgba(37, 99, 235, 0.16) 100%);
  font-weight: 600;
}

/* Status Dots & Semantic Badges */
.nx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.nx-dot-critical {
  background-color: var(--risk-critical);
  box-shadow: 0 0 8px var(--risk-critical);
}

.nx-dot-high {
  background-color: var(--risk-high);
  box-shadow: 0 0 8px var(--risk-high);
}

.nx-dot-low {
  background-color: var(--risk-low);
  box-shadow: 0 0 8px var(--risk-low);
}

.nx-dot-live {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: nxPulse 2s infinite;
}

@keyframes nxPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.2); }
}

.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nx-badge-critical {
  background: var(--risk-critical-bg);
  color: #fb7185;
  border-color: var(--risk-critical-border);
}

.nx-badge-high {
  background: var(--risk-high-bg);
  color: #fbbf24;
  border-color: var(--risk-high-border);
}

.nx-badge-low {
  background: var(--risk-low-bg);
  color: #34d399;
  border-color: var(--risk-low-border);
}

.nx-badge-info {
  background: rgba(59, 130, 246, 0.14);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.nx-badge-neutral {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.22);
}

/* Institutional Data Tables */
.nx-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: rgba(8, 13, 24, 0.8);
}

.nx-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.nx-table th {
  background: #0c1323;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.nx-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  vertical-align: middle;
}

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

.nx-table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

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

/* Enterprise Buttons & Inputs */
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nx-btn:hover:not(:disabled) {
  background: var(--bg-surface-3);
  border-color: var(--border-strong);
}

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

.nx-btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nx-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: #60a5fa;
}

.nx-input, .nx-select, .nx-textarea {
  width: 100%;
  background: #060a12;
  border: 1px solid var(--border-default);
  border-radius: 5px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nx-input:focus, .nx-select:focus, .nx-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Impede o Chrome/Edge de deixar o campo branco no autopreenchimento */
.nx-input:-webkit-autofill,
.nx-input:-webkit-autofill:hover,
.nx-input:-webkit-autofill:focus,
.nx-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 40px #060a12 inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc !important;
  border-color: var(--border-default) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Section Micro-Headers */
.nx-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Slide-over Drawer */
.nx-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.78);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
}

.nx-drawer-backdrop.open {
  display: flex;
  justify-content: flex-end;
}

.nx-drawer {
  width: 100%;
  max-width: 580px;
  background: var(--bg-surface-1);
  border-left: 1px solid var(--border-strong);
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.8);
  animation: nxDrawerSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes nxDrawerSlide {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ==========================================================================
   CYBER FORENSIC GRAPH VISUALIZATION ENGINE (ENTERPRISE PALANTIR GRADE)
   ========================================================================== */

/* Running energy flow on alert / defensive links */
@keyframes cyberFlowDash {
  to {
    stroke-dashoffset: -32;
  }
}

/* Holographic breathing pulse on nodes */
@keyframes cyberAuraPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.18;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.38;
  }
}

/* Radar scan rotation */
@keyframes cyberRadarSweep {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.cyber-graph-svg {
  user-select: none;
  background-color: transparent;
  outline: none;
}

/* Node Elements */
.cyber-node-group {
  cursor: pointer;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cyber-node-aura {
  transform-origin: center;
  animation: cyberAuraPulse 3s ease-in-out infinite;
  pointer-events: none;
}

.cyber-node-ring {
  transition: all 0.25s ease;
}

.cyber-node-core {
  transition: all 0.25s ease;
}

.cyber-node-label-plate {
  pointer-events: none;
  transition: all 0.2s ease;
}

/* Link Elements */
.cyber-link-path {
  fill: none;
  transition: stroke 0.25s ease, stroke-width 0.25s ease, opacity 0.25s ease;
}

.cyber-link-path.is-alert {
  stroke-dasharray: 6 5;
  animation: cyberFlowDash 1.4s linear infinite;
}

.cyber-edge-pill {
  cursor: pointer;
  transition: all 0.2s ease;
}

.cyber-edge-pill rect {
  transition: all 0.2s ease;
}

.cyber-edge-pill:hover rect {
  fill: #0c1527 !important;
  stroke: #38bdf8 !important;
  stroke-width: 1.6px !important;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.45));
}

/* Spotlight & Neighborhood Focus States */
.cyber-graph-active .cyber-node-group.is-dimmed,
.cyber-graph-active .cyber-link-group.is-dimmed {
  opacity: 0.08 !important;
  filter: grayscale(0.9) blur(0.5px);
}

.cyber-graph-active .cyber-node-group.is-highlighted {
  opacity: 1 !important;
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.2));
}

.cyber-graph-active .cyber-node-group.is-highlighted .cyber-node-ring {
  stroke-width: 3.5px !important;
}

.cyber-graph-active .cyber-link-group.is-highlighted .cyber-link-path {
  opacity: 1 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 8px currentColor);
}

.cyber-graph-active .cyber-link-group.is-highlighted .cyber-edge-pill rect {
  stroke-width: 1.5px !important;
  stroke: #38bdf8 !important;
}

/* Floating Cyber HUD Toolbar */
.cyber-graph-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 10, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.cyber-hud-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cyber-hud-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.cyber-hud-btn.active {
  background: rgba(37, 99, 235, 0.35);
  color: #60a5fa;
  border-color: #3b82f6;
}

/* Floating Forensic Tooltip */
.cyber-forensic-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  display: none;
  min-width: 260px;
  max-width: 340px;
  background: rgba(6, 11, 22, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(56, 189, 248, 0.15);
  transform: translate(-50%, -100%);
  margin-top: -16px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.cyber-forensic-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: rgba(6, 11, 22, 0.94);
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}



/* ==========================================================================
   KPI TELEMETRY CARDS (T-07 A T-10) & UTILITY HELPERS
   ========================================================================== */
.nx-kpi-card {
  background: linear-gradient(180deg, rgba(20, 30, 52, 0.82) 0%, rgba(11, 17, 30, 0.92) 100%);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  min-width: 0;
}

.nx-kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.nx-kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.nx-kpi-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.cyber-graph-svg {
  touch-action: none;
}

/* ==========================================================================
   RESPONSIVE MULTI-DEVICE ARCHITECTURE
   (Smartphones Portrait/Landscape, Tablets iPad/Android, MacBooks Retina, 4K)
   ========================================================================== */

/* Mobile & Tablet Off-Canvas Sidebar Backdrop */
#mobileSidebarBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

#mobileSidebarBackdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Bottom Quick Navigation Bar */
#mobileBottomNav {
  display: none;
}

/* --------------------------------------------------------------------------
   1. TABLETS & CELULARES (< 1024px): Off-Canvas Drawer & Fluid Containers
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  #appSidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    width: 288px !important;
    max-width: 86vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 70;
    transform: translateX(-104%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.85);
    border-right: 1px solid var(--border-strong);
  }

  #appSidebar.mobile-open {
    transform: translateX(0);
  }

  /* Em telas < 1024px, remove travas rigidas de altura interna para permitir scroll fluido */
  #screen-network {
    height: auto !important;
  }

  #screen-network > div {
    height: auto !important;
  }

  #grafoLabContainer {
    min-height: 380px !important;
    height: 420px !important;
  }

  /* Evita duplo scroll preso em containers internos no touch */
  #screen-timeline .max-h-\[700px\],
  #screen-penhora .max-h-\[700px\],
  #screen-financeiro .max-h-\[700px\],
  #screen-geointeligencia .max-h-\[700px\] {
    max-height: none !important;
    overflow-y: visible !important;
  }

  .nx-module-tab {
    flex: 0 0 auto;
    padding: 10px 14px;
  }

  .cyber-hud-btn {
    width: 34px;
    height: 34px;
  }
}

/* --------------------------------------------------------------------------
   2. SMARTPHONES (< 768px): Touch Ergonomics, Bottom Nav & Full-Width Modals
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* Previne auto-zoom indesejado do iOS Safari ao focar em inputs */
  .nx-input, .nx-select, .nx-textarea {
    font-size: 16px !important;
  }

  /* Barra inferior nativa para celulares em modo retrato */
  #mobileBottomNav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    background: rgba(8, 13, 25, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    padding-top: 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    padding-left: max(4px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.75);
  }

  .nx-mobile-dock-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 6px;
    border-radius: 6px;
    color: #94a3b8;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    transition: all 0.15s ease;
  }

  .nx-mobile-dock-btn.active {
    color: #60a5fa;
    background: rgba(37, 99, 235, 0.15);
  }

  /* Espaco inferior no main para nao encobrir conteudo com a barra mobile e botao Copilot */
  #mainWorkspaceScroll {
    padding: 10px !important;
    padding-bottom: 84px !important;
  }

  /* Ajustes de tabelas para toque */
  .nx-table th,
  .nx-table td {
    padding: 9px 10px;
    font-size: 11.5px;
  }

  /* Grafos e Mapas calibrados para tela de celular */
  #grafoDossieContainer,
  #grafoLabContainer {
    height: 350px !important;
    min-height: 310px !important;
  }

  #mapaGeointeligencia {
    min-height: 300px !important;
    height: 320px !important;
  }

  /* Tooltip forense cabe em 100% da largura do celular */
  .cyber-forensic-tooltip {
    min-width: 210px;
    max-width: 88vw;
    font-size: 11px;
  }

  /* Gaveta lateral ocupa 100% no celular */
  .nx-drawer {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100dvh !important;
    padding: 16px !important;
  }

  /* Botao Flutuante do Copilot acima da barra de navegacao mobile */
  #btnCopilotFlutuante {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
    height: 42px !important;
  }

  /* Janela do Copilot IA centralizada e responsiva no celular */
  #copilotModal {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 74px) !important;
    border-radius: 14px !important;
  }

  #toastContainer {
    left: 12px;
    right: 12px;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   3. TELA DEITADA / MOBILE & TABLET LANDSCAPE (Altura reduzida <= 560px)
   -------------------------------------------------------------------------- */
@media (max-height: 560px) and (orientation: landscape) {
  /* Oculta dock inferior na horizontal para ganhar 100% de area util vertical */
  #mobileBottomNav {
    display: none !important;
  }

  #mainWorkspaceScroll {
    padding: 8px 12px !important;
    padding-bottom: 24px !important;
  }

  /* Header principal mais compacto na tela deitada */
  #topCommandHeader {
    height: auto !important;
    min-height: 40px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  /* Grafos e mapas ajustados para caber inteiros na tela deitada */
  #grafoDossieContainer,
  #grafoLabContainer,
  #mapaGeointeligencia {
    height: calc(100dvh - 96px) !important;
    min-height: 220px !important;
    max-height: 360px !important;
  }

  /* Copilot e Modais aproveitam toda a altura da tela deitada */
  #copilotModal {
    top: 6px !important;
    bottom: 6px !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    max-height: calc(100dvh - 12px) !important;
    width: auto !important;
  }

  #copilotThread {
    max-height: none !important;
    flex: 1 1 auto !important;
  }

  #btnCopilotFlutuante {
    bottom: 10px !important;
    right: max(12px, env(safe-area-inset-right)) !important;
  }

  #minutaModalBackdrop > div {
    max-height: 94dvh !important;
    padding: 12px !important;
  }
}

/* --------------------------------------------------------------------------
   4. MACBOOKS RETINA (13"/14"/16"), iMAC & MONITORES ULTRALARGOS (2K/4K)
   -------------------------------------------------------------------------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .nx-panel,
  .nx-card,
  .nx-table-container {
    border-width: 0.5px;
  }
}

@media (min-width: 1920px) {
  html, body {
    font-size: 14px;
  }
  #grafoDossieContainer {
    height: 540px;
    max-height: 600px;
  }
}

/* ==========================================================================
   5. FORENSIC RELATIONAL MATRIX & EMPLOYEES UI (T-09, T-11 & T-12)
   ========================================================================== */

.nx-doc-pill {
  display: inline-flex;
  align-items: center;
  padding: 2.5px 8px;
  border-radius: 4px;
  background: rgba(6, 10, 18, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.16);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #cbd5e1;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.nx-money-cell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

.nx-rel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 11px;
  line-height: 1.35;
  color: #e2e8f0;
  transition: all 0.15s ease;
}

.nx-rel-chip:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(22, 34, 62, 0.95);
}

.nx-rel-chip-foco {
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.35) 0%, rgba(15, 23, 42, 0.9) 100%);
  border-color: rgba(16, 185, 129, 0.38);
}

.nx-rel-role {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.28);
  white-space: nowrap;
}

.nx-rel-role-exec {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.32);
}

.nx-rel-role-fam {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.32);
}

.nx-score-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.nx-score-bar-track {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.nx-score-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.nx-entity-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.nx-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(12, 19, 34, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nx-filter-pill:hover {
  color: #f8fafc;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(20, 32, 58, 0.9);
}

.nx-filter-pill.active {
  color: #ffffff;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.32) 0%, rgba(29, 78, 216, 0.18) 100%);
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.25);
}

