/*
 * PROYECTO: Nexus UI
 * DESCRIPCIÓN: Escala común de tipografía, iconos, navegación y controles para módulos.
 * EJECUCIÓN: Cargado después del CSS propio en vistas internas Nexus.
 * NOTAS: Mantto conserva sus temas; esta capa fija forma y jerarquía, no colores de superficie.
 */
:root {
  --nx-bg-app: #07090e;
  --nx-bg-sidebar: #090b10;
  --nx-bg-card: #0d1017;
  --nx-bg-hover: #141822;
  --nx-text: #f8fafc;
  --nx-muted: #94a3b8;
  --nx-orange: #f38020;
  --nx-orange-hover: #ea580c;
  --nx-green: #10b981;
  --nx-amber: #f59e0b;
  --nx-red: #f43f5e;
  --nx-border: rgba(255,255,255,.08);
  --nx-border-accent: rgba(243,128,32,.24);
  --nx-font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nx-font-code: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --nx-size-body: .875rem;
  --nx-size-help: .8125rem;
  --nx-size-label: .8rem;
  --nx-size-h1: 1.35rem;
  --nx-size-h2: 1.15rem;
  --nx-size-h3: .95rem;
  --nx-size-table-head: .72rem;
  --nx-size-table-cell: .85rem;
  --nx-size-button: .85rem;
  --nx-icon-nav: 20px;
  --nx-icon-mobile: 21px;
  --nx-icon-action: 18px;
  --nx-icon-feature: 26px;
  --nx-control-height: 44px;
}

body { font-family: var(--nx-font-ui); font-size: var(--nx-size-body); }
code, .mono, .mono-code, .badge-mono { font-family: var(--nx-font-code); }

/* Capa de protección z-index para ventanas modales (por encima de copilotos flotantes y barras inferiores) */
.modal-overlay {
  z-index: 10005 !important;
}
.modal-window {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  max-height: calc(100dvh - 24px) !important;
}
.modal-window .modal-header {
  flex-shrink: 0 !important;
}
.modal-window .modal-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.modal-window .modal-footer {
  flex-shrink: 0 !important;
  position: sticky !important;
  bottom: 0 !important;
  background: #0d1017 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 12px 18px !important;
  z-index: 30 !important;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.7) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Jerarquía compartida. Display/hero queda reservado al Hub. */
h1, .page-title, .nwms-title, .nm-view-title, #module-title, #title { font-size: var(--nx-size-h1) !important; font-weight: 800; line-height: 1.3; letter-spacing: -.02em; }
.nap-hero h1, .home-hero-title { font-size: clamp(1.75rem, 3vw, 2rem) !important; }
h2 { font-size: var(--nx-size-h2) !important; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
h3 { font-size: var(--nx-size-h3) !important; font-weight: 700; line-height: 1.4; }
p, .text-body { font-size: var(--nx-size-body); line-height: 1.55; }
.muted, .help-text, .page-help, .nwms-subtitle { color: var(--nx-muted); font-size: var(--nx-size-help); }
#subtitle, #module-help, #list-help { color: var(--nx-muted); font-size: var(--nx-size-help) !important; line-height: 1.55; }
label, .field span, .nwms-label { font-size: var(--nx-size-label); font-weight: 600; }

/* Marca y barras principales comparten escala aunque cada módulo tenga su layout. */
.brand-logo, .brand, .module-brand, .nwms-home-link, .nap-brand-title, .nm-brand { font-size: 1.05rem !important; font-weight: 800; letter-spacing: normal; }
.topbar, .module-topbar, .nwms-topbar, .nm-topbar, .nap-topbar {
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  padding: 0 16px !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  box-sizing: border-box !important;
}

/* Misma geometría SVG en módulos; el tema/contexto define el color. */
.nx-svg-icon, .nav-icon, .mob-svg-icon, .nm-icon, .btn-icon {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-icon { width: var(--nx-icon-nav); height: var(--nx-icon-nav); }
.nav-icon > .nx-svg-icon { width: 100%; height: 100%; color: inherit; stroke: currentColor; }
.nav-button .nx-svg-icon, .nm-nav-btn .nx-svg-icon, .module-nav-button > .nx-svg-icon { width: var(--nx-icon-nav); height: var(--nx-icon-nav); }
.nwms-nav-btn .nx-svg-icon { width: var(--nx-icon-nav); height: var(--nx-icon-nav); }
.mob-svg-icon, .mob-nav-icon > svg { width: var(--nx-icon-mobile); height: var(--nx-icon-mobile); }
.mob-nav-icon .nx-svg-icon, .nav-button > .nx-svg-icon, .module-nav-button > .nx-svg-icon, .nm-bottom-btn .nx-svg-icon { color: inherit; stroke: currentColor; }
.nm-bottom-btn .nx-svg-icon { width: var(--nx-icon-mobile); height: var(--nx-icon-mobile); }
.nm-btn .nx-svg-icon { width: var(--nx-icon-action); height: var(--nx-icon-action); }
.btn-icon { width: var(--nx-icon-action); height: var(--nx-icon-action); }
.nap-mod-icon .nx-svg-icon, .nwms-kpi-icon .nx-svg-icon, .module-card > .nx-svg-icon { width: var(--nx-icon-feature) !important; height: var(--nx-icon-feature) !important; }
.nx-svg-icon { vertical-align: -.16em; }

/* Botones: misma tipografía, peso, radio y altura; colores semánticos propios. */
button, a.button, .btn, .nap-btn, .primary, .secondary, .nm-btn, .hub, .module-hub-link,
.module-nav-button, .nav-button {
  font-family: var(--nx-font-ui);
  font-size: var(--nx-size-button);
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
}
 a.button, .btn, .nap-btn, .primary, .secondary, .nm-btn, .hub, .module-hub-link { font-size: var(--nx-size-button) !important; }
.btn .nx-svg-icon, .nap-btn .nx-svg-icon, .primary .nx-svg-icon, .secondary .nx-svg-icon, .nm-btn .nx-svg-icon { width: var(--nx-icon-action) !important; height: var(--nx-icon-action) !important; }
.btn-primary, .nap-btn-primary, .primary, .nm-btn-primary {
  font-weight: 700;
}
html:not([data-theme="bw-neutral"]) .btn-primary,
html:not([data-theme="bw-neutral"]) .nap-btn-primary,
html:not([data-theme="bw-neutral"]) .primary,
html:not([data-theme="bw-neutral"]) .nm-btn-primary {
  background: var(--nx-orange) !important;
  background-image: none !important;
  border-color: var(--nx-orange) !important;
  color: #07090e !important;
}
html:not([data-theme="bw-neutral"]) .btn-primary:hover,
html:not([data-theme="bw-neutral"]) .nap-btn-primary:hover,
html:not([data-theme="bw-neutral"]) .primary:hover,
html:not([data-theme="bw-neutral"]) .nm-btn-primary:hover { background: var(--nx-orange-hover) !important; border-color: var(--nx-orange-hover) !important; }
html:not([data-theme="bw-neutral"]) .nm-btn-primary .nx-svg-icon { stroke: #07090e; color: #07090e; filter: none; }
html[data-theme="bw-neutral"] .nm-btn-primary .nx-svg-icon { stroke: var(--accent-contrast); color: var(--accent-contrast); filter: none; }
a.button, .btn, .nap-btn, .primary, .secondary, .nm-btn, .hub, .module-hub-link {
  min-height: 40px;
}
.module-nav-button, .nav-button { min-height: 42px; }
.nm-nav-btn { font-size: .85rem !important; font-weight: 600; border-radius: 8px; }
.nwms-nav-btn { font-size: .85rem !important; font-weight: 600; border-radius: 8px; }
.nm-bottom-btn { font-size: .66rem !important; font-weight: 600; }
.suite-launcher-btn { font-family: var(--nx-font-ui); font-size: .85rem !important; font-weight: 600; border-radius: 8px; min-height: 40px; }
.module-nav-button.active, .nav-button.active { font-weight: 700; }
.nav-section .nav-link { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 8px; font-size: .85rem; font-weight: 600; text-decoration: none; }
.btn-sm, .module-actions button { min-height: 36px; font-size: .8rem !important; font-weight: 600; }

/* Metadatos de tabla y valores técnicos mantienen una escala legible común. */
th, .table-th { font-size: var(--nx-size-table-head) !important; font-weight: 700; letter-spacing: .05em; }
td, .table-td { font-size: var(--nx-size-table-cell) !important; font-weight: 500; }
.mono, .mono-code, .badge-mono { font-size: .8rem; }

@media (max-width: 800px) {
  h1, .page-title, .nwms-title, .nm-view-title, #module-title, #title { font-size: 1.25rem !important; }
  .nap-hero h1, .home-hero-title { font-size: 1.75rem !important; }
  a.button, .btn, .nap-btn, .primary, .secondary, .nm-btn, .hub, .module-hub-link { min-height: 44px; }
  .btn-sm, .module-actions button { min-height: 44px; }
  .mob-nav-label, #mobile-nav .nav-button, .module-mobile-nav .module-nav-button,
  .nm-bottom-btn { font-size: .66rem; font-weight: 600; letter-spacing: .01em; }
}

/* Marco compartido entre el CRM y las vistas del Hub. */
.topbar, .module-topbar, .nwms-topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 200 !important;
  overflow: visible !important;
  background: #090b10 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
}
.module-brand { display: inline-flex; align-items: center; gap: 8px; }
.module-platform-name, .nm-platform-name, .brand-module { color: var(--nx-orange); font-size: .9rem; font-weight: 700; }
.module-platform-label { color: var(--nx-orange); font-size: .9rem; font-weight: 700; white-space: nowrap; }
.nexus-business-name {
  display: block;
  min-width: 0;
  max-width: 24vw;
  overflow: hidden;
  color: #cbd5e1;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.active-business-pill { padding: 0; border: 0; border-radius: 0; background: transparent; }
.nap-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nap-brand > a { display: inline-flex; flex: 0 0 auto; }
.nap-brand-title { color: var(--nx-orange); font-size: .9rem !important; white-space: nowrap; }
.nap-brand-sub.nexus-business-name { max-width: 22vw; }
.nap-topbar { flex-wrap: nowrap !important; }
.nap-user-bar { width: auto !important; flex: 0 0 auto; }
.nx-brand-logo, .brand-icon, .brand-icon img {
  display: block !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  flex: 0 0 38px !important;
  object-fit: contain !important;
  border: 1px solid rgba(243,128,32,.4) !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
}
.module-brand, .brand-logo, .nwms-home-link, .nm-brand, .brand > a {
  width: auto !important;
  height: 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  flex: 0 0 auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  text-decoration: none !important;
}
.nx-brand-wordmark {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 5px !important;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
  font-size: 1.06rem !important;
  line-height: 1 !important;
  letter-spacing: -0.02em !important;
  white-space: nowrap !important;
  user-select: none !important;
}
.nx-brand-nexus {
  color: #f38020 !important;
  font-weight: 800 !important;
}
.nx-brand-platform {
  color: #ffffff !important;
  font-weight: 700 !important;
}
@media (max-width: 420px) {
  .nx-brand-wordmark {
    font-size: 0.94rem !important;
    gap: 4px !important;
  }
}
.module-topbar #company-name {
  flex: 0 1 auto;
  max-width: 24vw;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #cbd5e1;
}
.module-topbar .module-hub-link {
  border-color: rgba(255,255,255,.12);
  background: #0d1017;
  color: #f8fafc;
}
.module-card {
  border-color: rgba(255,255,255,.08);
  border-radius: 12px;
}
.mobile-bottom-nav, .module-mobile-nav {
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  background: rgba(9,11,16,.96);
  border-top: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 -4px 18px rgba(0,0,0,.32);
}
.module-mobile-nav .module-nav-button {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.module-mobile-nav .module-nav-button.active {
  border: 0;
  background: transparent;
}
.module-mobile-nav .module-nav-button.active::before { top: 0; }

/* ============================================================================
 * ENCABEZADO UNIVERSAL, NOTIFICACIONES Y CUENTA ADAPTATIVA
 * ============================================================================ */
.topbar-right,
#nexus-account-menu {
  display: inline-flex !important;
  align-items: center !important;
  height: 38px !important;
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  gap: 0 !important;
  flex: 0 0 auto !important;
}
.topbar-right #nexus-account-menu {
  margin-left: 0 !important;
}
.nx-topbar-right-cluster {
  display: inline-flex !important;
  align-items: center !important;
  height: 38px !important;
  gap: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
}

/* Ocultar nombres de módulo y empresa en el encabezado (estándar minimalista) */
#module-platform-name,
.module-platform-label,
.nwms-logo-badge,
.brand-module,
.nm-platform-name,
#company-name,
#currentTenantName,
#nwmsTenantBadge,
#company,
#tenantBadge,
.brand-logo-text {
  display: none !important;
}

/* Contenedor izquierdo unificado de navegación y marca */
.topbar-left,
.nm-topbar-left,
.nwms-brand,
.brand {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  height: 38px !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Botón colapsable del menú lateral en encabezado */
.nx-header-menu-btn,
#btnMobileMenu.mobile-menu-btn,
#btnToggleDrawer.nm-drawer-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #cbd5e1 !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  flex: 0 0 38px !important;
  transition: all 0.18s ease !important;
}
.nx-header-menu-btn:hover,
#btnMobileMenu.mobile-menu-btn:hover,
#btnToggleDrawer.nm-drawer-btn:hover {
  background: rgba(243, 128, 32, 0.12) !important;
  border-color: rgba(243, 128, 32, 0.4) !important;
  color: #f38020 !important;
}
.nx-header-menu-btn svg,
#btnMobileMenu.mobile-menu-btn svg,
#btnToggleDrawer.nm-drawer-btn svg {
  width: 20px !important;
  height: 20px !important;
  stroke: currentColor !important;
}

/* 1. Centro de Notificaciones / Periodo de Prueba en Topbar */
.nx-notif-menu {
  position: relative;
  display: inline-flex;
}
.nx-notif-trigger {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #cbd5e1 !important;
  cursor: pointer !important;
  position: relative !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  flex: 0 0 38px !important;
  transition: all 0.18s ease !important;
}
.nx-notif-trigger:hover, .nx-notif-trigger[aria-expanded="true"] {
  border-color: rgba(243, 128, 32, 0.45);
  background: rgba(243, 128, 32, 0.1);
  color: #f38020;
}
.nx-notif-trigger svg, .nx-notif-trigger .nx-svg-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.nx-notif-badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.85);
  border: 1.5px solid #0d1017;
}
.nx-notif-badge-dot.warning {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.85);
}
.nx-notif-badge-dot.danger {
  background: #f43f5e;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.85);
}
.nx-notif-panel {
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  position: absolute;
  z-index: 10050;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 20px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #0d1017;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  color: #f8fafc;
}
.nx-notif-panel[hidden] { display: none !important; }
.nx-notif-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.nx-notif-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}
.nx-notif-pill {
  min-width: 0;
  max-width: 100%;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(243, 128, 32, 0.15);
  color: #fb923c;
  border: 1px solid rgba(243, 128, 32, 0.3);
}
.nx-notif-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0 0 12px 0;
}
.nx-notif-cta {
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #f38020;
  color: #07090e !important;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.nx-notif-cta:hover { background: #fb923c; }

/* 2. Disparador de Logo y Cuenta con soporte rectangular y alargado */
.nx-account-menu { position: relative; display: inline-flex; }
.nx-account-menu [hidden] { display: none !important; }
.nx-account-trigger {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  min-width: 38px !important;
  max-width: min(220px, 42vw) !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  border: 1px solid rgba(243, 128, 32, 0.4) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #f8fafc !important;
  box-shadow: 0 0 10px rgba(243, 128, 32, 0.12) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  overflow: hidden !important;
  flex: 0 1 auto !important;
}
.nx-account-trigger:hover, .nx-account-trigger[aria-expanded="true"] {
  border-color: rgba(243, 128, 32, 0.7) !important;
  background: rgba(243, 128, 32, 0.08) !important;
  box-shadow: 0 0 14px rgba(243, 128, 32, 0.25) !important;
}
.nx-account-trigger:focus-visible, .nx-account-logout:focus-visible {
  outline: 2px solid #f38020;
  outline-offset: 2px;
}
.nx-account-logo {
  display: block !important;
  height: 100% !important;
  max-height: 34px !important;
  width: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
  border-radius: 4px !important;
}
.nx-account-fallback {
  width: 34px !important;
  height: 34px !important;
  border-radius: 6px !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(243, 128, 32, 0.16) !important;
  color: #fb923c !important;
  font-size: 0.85rem !important;
  font-weight: 800 !important;
}
.nx-account-panel {
  position: absolute;
  z-index: 10050;
  top: calc(100% + 8px);
  right: 0;
  width: min(280px, calc(100vw - 24px));
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #0d1017;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  color: #f8fafc;
}
.nx-account-panel[hidden] { display: none !important; }
.nx-account-company, .nx-account-identity { display: block; overflow-wrap: anywhere; }
.nx-account-company { font-size: 0.88rem; font-weight: 700; }
.nx-account-identity { margin-top: 4px; color: #94a3b8; font-size: 0.75rem; }
.nx-account-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 0.78rem;
  text-decoration: none;
  transition: all 0.15s ease;
}
.nx-account-link:hover {
  background: rgba(243, 128, 32, 0.12);
  color: #f38020;
}
button.nx-account-link { width: 100%; min-height: 0; justify-content: flex-start; border: 0; font-family: inherit; font-size: 0.78rem !important; font-weight: 400; line-height: normal; text-align: left; cursor: pointer; }
.nx-account-install[hidden], .nx-account-help[hidden] { display: none !important; }
.nx-account-help { margin: 6px 2px 0; color: #94a3b8; font-size: 0.74rem; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.nx-account-logout {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 8px;
  background: rgba(244, 63, 94, 0.1);
  color: #fda4af;
  cursor: pointer;
  transition: background 0.15s ease;
}
.nx-account-logout:hover { background: rgba(244, 63, 94, 0.18); }
.nm-topbar-right { display: flex; align-items: center; gap: 10px; }

/* Eliminación de banners de prueba intrusivos en contenido */
#trialCountdownBanner,
#homeHeroPlanBadge,
#trial-banner,
.trial-global-banner:not(#sessionResilienceBanner) {
  display: none !important;
}

.session-resilience-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef3c7;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.14);
  backdrop-filter: blur(12px);
}
.session-resilience-banner .session-resilience-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #fef3c7;
}
.session-resilience-banner .session-resilience-pulse {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .session-resilience-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }
}

/* ============================================================================
 * ESTÁNDAR DE CABECERA DE CONTENIDO (H1 COMPACTO + SUBTÍTULO)
 * ============================================================================ */
.nx-page-header,
.module-view-header,
.nwms-page-header,
.page-heading,
.section-header {
  margin-bottom: 18px !important;
}
.nx-page-header h1,
.module-view-header h1,
.nwms-page-header h1,
.page-heading h1,
.section-header h1,
.section-header h2 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #f8fafc !important;
  margin: 0 0 4px 0 !important;
  line-height: 1.3 !important;
}
.nx-page-header p,
.module-view-header p,
.nwms-page-header p,
.page-heading p.subtitle,
.section-header p {
  font-size: 0.82rem !important;
  color: #94a3b8 !important;
  margin: 0 !important;
  line-height: 1.4 !important;
}

/* ============================================================================
 * BARRA DE NAVEGACIÓN INFERIOR UNIVERSAL (MÓVIL <= 768px)
 * ============================================================================ */
.nx-universal-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: #07090e;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: none;
  align-items: stretch;
  justify-content: space-around;
  z-index: 9999;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(8px);
}
@media (max-width: 768px) {
  .nx-universal-bottom-nav {
    display: flex !important;
  }
  body {
    padding-bottom: 64px !important;
  }
  .main-stage, .module-main, .nwms-layout, main {
    padding-bottom: 74px !important;
  }
  /* Ocultar barras móviles dispares previas */
  #mobileBottomNav, #module-mobile-nav, #mobile-nav {
    display: none !important;
  }
}
.nx-bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.66rem;
  font-weight: 600;
  position: relative;
  background: transparent;
  border: none;
  padding: 4px 2px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}
.nx-bottom-nav-item:hover { color: #f8fafc; }
.nx-bottom-nav-item.active {
  color: #f38020;
  font-weight: 700;
}
.nx-bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background: #f38020;
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 8px rgba(243, 128, 32, 0.8);
}
.nx-bottom-icon {
  width: 21px;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nx-bottom-icon svg, .nx-bottom-icon .nx-svg-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}
.nx-bottom-label {
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* Integración limpia de sidebar RRHH cuando monta el árbol unificado */
.nexus-hr-shell .sidebar.nx-has-unified-nav .workspace-label,
.nexus-hr-shell .sidebar.nx-has-unified-nav > h2,
.nexus-hr-shell .sidebar.nx-has-unified-nav .sidebar-bottom {
  display: none !important;
}
.nexus-hr-shell .sidebar.nx-has-unified-nav {
  padding: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

@media (max-width: 800px) {
  .nap-brand { gap: 7px; }
}

@media (max-width: 768px) {
  .nexus-hr-shell .brand { gap: 7px; font-size: .8rem; letter-spacing: 0; }
  .nexus-hr-shell .top-right { gap: 8px; }
}


/* ============================================================================
 * ÁRBOL DE NAVEGACIÓN UNIFICADO DEL SISTEMA (MÓDULOS + APARTADOS) & DRAWER MÓVIL
 * ============================================================================ */
@media (min-width: 901px) {
  body:not(.nx-sidebar-collapsed) .module-layout {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }
  body:not(.nx-sidebar-collapsed) .module-sidebar,
  body:not(.nx-sidebar-collapsed) .nm-sidebar {
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    overflow-x: hidden !important;
  }
}

.module-sidebar nav,
#module-nav,
#sidebarNavOperativo,
#nwmsSidebarNav,
#desktop-nav {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 8px !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

.nx-unified-nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  padding: 4px 0 16px;
  box-sizing: border-box;
}

.nx-sys-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 6px 10px 4px;
  user-select: none;
}

.nx-sys-mod-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  box-sizing: border-box;
  transition: background 0.15s ease;
}

.nx-sys-mod-group.is-active-module {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin: 2px 0;
  padding: 2px 4px 6px;
}

.nx-sys-mod-btn {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 40px !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  color: #cbd5e1 !important;
  text-decoration: none !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
}

.nx-sys-mod-btn:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
}

.nx-sys-mod-btn.active {
  background: rgba(243, 128, 32, 0.14) !important;
  border-color: rgba(243, 128, 32, 0.35) !important;
  color: #f38020 !important;
  font-weight: 700 !important;
}

.nx-sys-mod-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.nx-sys-mod-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f38020;
  margin-left: auto;
  flex-shrink: 0;
}

.nx-sys-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: auto;
  max-width: calc(100% - 14px);
  margin: 4px 2px 2px 12px;
  padding-left: 8px;
  border-left: 1.5px solid rgba(243, 128, 32, 0.35);
  box-sizing: border-box;
}

.nx-sys-sub-item {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 5px 8px !important;
  border: none !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: #94a3b8 !important;
  font-family: var(--nx-font-ui) !important;
  font-size: 0.79rem !important;
  font-weight: 500 !important;
  text-align: left !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  transition: all 0.14s ease !important;
}

.nx-sys-sub-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #e2e8f0 !important;
}

.nx-sys-sub-item.active {
  background: rgba(243, 128, 32, 0.12) !important;
  color: #fb923c !important;
  font-weight: 700 !important;
}

.nx-sys-sub-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.nx-sys-sub-item.active .nx-sys-sub-dot {
  opacity: 1;
  box-shadow: 0 0 6px rgba(243, 128, 32, 0.85);
}

.nx-sys-sub-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ajuste de botones submit en grillas de formulario (evitar botones gigantes) */
.form-grid > .form-actions,
.form-grid > button[type="submit"],
.form-grid > .primary {
  grid-column: 1 / -1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin-top: 4px !important;
}

.form-grid button.primary,
.form-grid .form-submit-btn {
  width: auto !important;
  min-width: 150px !important;
  max-width: 240px !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 42px !important;
  padding: 0 20px !important;
  flex: 0 0 auto !important;
}

/* Barra horizontal estandarizada de sub-apartados para móvil / tablet (<= 900px) */
.nx-mobile-subtabs {
  display: none;
  align-items: stretch;
  flex-wrap: nowrap !important;
  gap: 8px;
  overflow: visible !important;
  padding: 8px 12px 10px;
  margin-bottom: 12px;
  background: rgba(9, 11, 16, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nx-mobile-subtabs::-webkit-scrollbar {
  display: none;
}

.nx-mobile-subtab-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 9px;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: #121722 !important;
  color: #e2e8f0 !important;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: none !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
  transition: background 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nx-mobile-subtab-btn.active {
  background: #f38020 !important;
  border-color: #f38020 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.nx-subtab-more {
  position: relative;
  flex: 1 0 auto;
  min-width: 0;
}

.nx-subtab-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 8px !important;
  background: #121722 !important;
  color: #e2e8f0 !important;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: none !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
}
.nx-subtab-trigger::-webkit-details-marker { display: none; }
.nx-subtab-trigger::after { content: '▾'; color: #94a3b8; }
.nx-subtab-trigger.is-active,
.nx-subtab-more[open] .nx-subtab-trigger {
  border-color: #f38020 !important;
  color: #fb923c !important;
  background: #1b1614 !important;
}

.nx-subtab-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(260px, calc(100vw - 28px));
  padding: 8px;
  z-index: 60;
  display: grid;
  gap: 6px;
  background: #0f131a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.nx-subtab-more:not([open]) .nx-subtab-menu { display: none; }
.nx-subtab-menu > .nx-mobile-subtab-btn {
  width: 100%;
  flex: none;
  justify-content: flex-start;
  text-align: left;
  min-height: 38px;
  height: auto;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.25;
  padding: 8px 12px;
}

/* Desactivar backdrop legacy con blur en crm.html */
#sidebarBackdrop,
.sidebar-backdrop {
  display: none !important;
  pointer-events: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Backdrop limpio sin blur (evita bug de composición GPU sobre sidebars fijos en móvil) */
.nx-drawer-backdrop {
  position: fixed !important;
  top: 58px !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(3, 5, 12, 0.72) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 10010 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease !important;
}

.nx-drawer-backdrop.open {
  opacity: 1 !important;
  pointer-events: auto !important;
}

@media (max-width: 900px) {
  html.nx-drawer-open {
    overflow: hidden !important;
    overscroll-behavior: none;
  }
  .module-topbar {
    position: sticky;
    top: 0;
  }
  .nx-drawer-backdrop.open {
    touch-action: none;
  }
  .nx-mobile-subtabs {
    display: flex !important;
  }
  .nwms-mobile-nav {
    display: none !important;
  }
  .module-sidebar,
  .sidebar,
  .nwms-sidebar,
  .nm-sidebar {
    position: fixed !important;
    top: 58px !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(285px, 84vw) !important;
    max-width: 84vw !important;
    background: #090b10 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
    z-index: 10030 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    transform: translateX(-105%) !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: block !important;
    padding-bottom: 84px !important;
    box-shadow: 14px 0 38px rgba(0, 0, 0, 0.75) !important;
    pointer-events: auto !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .module-sidebar.open,
  .module-sidebar.active,
  .sidebar.open,
  .sidebar.active,
  .sidebar.mobile-open,
  .nwms-sidebar.open,
  .nwms-sidebar.active,
  .nm-sidebar.open,
  .nm-sidebar.active {
    transform: translateX(0) !important;
  }
  .nexus-hr-shell .sidebar.nx-has-unified-nav {
    padding: 0 0 84px 0 !important;
  }
}

/* Colapso uniforme de sidebar en escritorio (>= 901px) para toda la suite */
@media (min-width: 901px) {
  body.nx-sidebar-collapsed .module-layout {
    grid-template-columns: 68px minmax(0, 1fr) !important;
  }
  body.nx-sidebar-collapsed.nexus-hr-shell main {
    margin-left: 68px !important;
  }
  body.nx-sidebar-collapsed .module-sidebar,
  body.nx-sidebar-collapsed .sidebar,
  body.nx-sidebar-collapsed .nwms-sidebar,
  body.nx-sidebar-collapsed .nm-sidebar {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    padding: 10px 8px !important;
    overflow-x: hidden !important;
  }
  body.nx-sidebar-collapsed .module-sidebar nav,
  body.nx-sidebar-collapsed #module-nav,
  body.nx-sidebar-collapsed #sidebarNavOperativo,
  body.nx-sidebar-collapsed #nwmsSidebarNav,
  body.nx-sidebar-collapsed #desktop-nav {
    padding: 0 !important;
  }
  body.nx-sidebar-collapsed .nx-unified-nav-list {
    align-items: center !important;
    gap: 4px !important;
    padding: 2px 0 14px !important;
  }
  body.nx-sidebar-collapsed .nx-sys-mod-group,
  body.nx-sidebar-collapsed .nx-sys-mod-group.is-active-module,
  html[data-nx-theme="light"] body.nx-sidebar-collapsed .nx-sys-mod-group.is-active-module {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border-color: transparent !important;
    align-items: center !important;
  }
  body.nx-sidebar-collapsed .nx-sys-mod-btn {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
    border-radius: 10px !important;
  }
  body.nx-sidebar-collapsed .nx-sys-subnav,
  body.nx-sidebar-collapsed .nx-sys-section-label,
  body.nx-sidebar-collapsed .nx-sys-mod-title,
  body.nx-sidebar-collapsed .nx-sys-mod-chev,
  body.nx-sidebar-collapsed .module-sidebar .module-nav-button span,
  body.nx-sidebar-collapsed .sidebar .nav-item span,
  body.nx-sidebar-collapsed .sidebar .nav-section-title,
  body.nx-sidebar-collapsed .nwms-sidebar .nwms-nav-btn span:last-child,
  body.nx-sidebar-collapsed .nwms-sidebar .nwms-nav-group-label,
  body.nx-sidebar-collapsed .nm-sidebar .nm-nav-group-title,
  body.nx-sidebar-collapsed .nm-sidebar .nm-nav-btn .nm-badge,
  body.nx-sidebar-collapsed .nexus-hr-shell .sidebar .workspace-label,
  body.nx-sidebar-collapsed .nexus-hr-shell .sidebar > h2,
  body.nx-sidebar-collapsed .nexus-hr-shell .sidebar .sidebar-bottom,
  body.nx-sidebar-collapsed .nexus-hr-shell .sidebar .nav-button > span {
    display: none !important;
  }
  body.nx-sidebar-collapsed .nm-sidebar .nm-nav-btn,
  body.nx-sidebar-collapsed .nexus-hr-shell .sidebar .nav-button {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 42px !important;
    padding: 0 !important;
    margin: 2px auto !important;
    justify-content: center !important;
    font-size: 0 !important;
    gap: 0 !important;
  }
  body.nx-sidebar-collapsed .nm-sidebar .nm-nav-btn > span:first-child {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
  }
}

/* NX-OPS-010: neutraliza también inserciones tardías del lanzador de soporte antiguo. */
#nexus-support-link { display: none !important; }


/* ============================================================================
 * INTERRUPTOR DE TEMA EN MENÚ DE USUARIO + MODO CLARO UNIFICADO (NEXUS TRADING)
 * Actividad: NX-UI-THEME-001
 * ============================================================================ */
.nx-account-theme-toggle {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  cursor: pointer !important;
}
.nx-account-theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nx-account-theme-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 600;
}
.nx-account-theme-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(243, 128, 32, 0.16);
  color: #fb923c;
  border: 1px solid rgba(243, 128, 32, 0.34);
  flex-shrink: 0;
}

html[data-nx-theme="light"] {
  color-scheme: light;
  --nx-bg-app: #f8fafc;
  --nx-bg-sidebar: #ffffff;
  --nx-bg-card: #ffffff;
  --nx-bg-hover: #f1f5f9;
  --nx-text: #0f172a;
  --nx-muted: #475569;
  --nx-border: rgba(15, 23, 42, 0.10);
  --nx-border-accent: rgba(243, 128, 32, 0.38);

  --bg-app: #f8fafc;
  --bg-body: #f8fafc;
  --bg-page: #f8fafc;
  --bg-topbar: rgba(255, 255, 255, 0.96);
  --text-topbar: #0f172a;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;

  --border: rgba(15, 23, 42, 0.10);
  --border-subtle: rgba(15, 23, 42, 0.10);
  --border-color: rgba(15, 23, 42, 0.10);
  --border-light: rgba(15, 23, 42, 0.16);
  --nexus-border: rgba(243, 128, 32, 0.34);

  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #475569;

  --accent: #f38020;
  --accent-hover: #ea580c;
  --accent-light: #ea580c;
  --accent-blue: #ea580c;
  --accent-subtle: rgba(243, 128, 32, 0.10);
  --nexus-orange: #f38020;
  --nexus-orange-hover: #ea580c;
  --nexus-orange-subtle: rgba(243, 128, 32, 0.10);
  --cf-orange: #f38020;
  --cf-orange-hover: #ea580c;
  --cf-orange-subtle: rgba(243, 128, 32, 0.10);

  --shadow-card: 0 2px 10px rgba(15, 23, 42, 0.05);
}

html[data-nx-theme="light"] body {
  background: #f8fafc !important;
  background-image: none !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nx-svg-icon {
  filter: none !important;
}

/* Topbar y Marca en Modo Claro (Estilo Nexus Trading) */
html[data-nx-theme="light"] .topbar,
html[data-nx-theme="light"] .module-topbar,
html[data-nx-theme="light"] .nwms-topbar,
html[data-nx-theme="light"] .nm-topbar,
html[data-nx-theme="light"] .nap-topbar,
html[data-nx-theme="light"] body > header {
  background: #ffffff !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10) !important;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

html[data-nx-theme="light"] .nx-brand-platform {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nexus-business-name,
html[data-nx-theme="light"] .module-topbar #company-name {
  color: #334155 !important;
}

html[data-nx-theme="light"] .nx-header-menu-btn,
html[data-nx-theme="light"] #btnMobileMenu.mobile-menu-btn,
html[data-nx-theme="light"] #btnToggleDrawer.nm-drawer-btn,
html[data-nx-theme="light"] .nx-notif-trigger {
  background: #f8fafc !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
  color: #334155 !important;
}

html[data-nx-theme="light"] .nx-header-menu-btn:hover,
html[data-nx-theme="light"] #btnMobileMenu.mobile-menu-btn:hover,
html[data-nx-theme="light"] #btnToggleDrawer.nm-drawer-btn:hover,
html[data-nx-theme="light"] .nx-notif-trigger:hover,
html[data-nx-theme="light"] .nx-notif-trigger[aria-expanded="true"] {
  background: rgba(243, 128, 32, 0.12) !important;
  border-color: rgba(243, 128, 32, 0.45) !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .nx-account-trigger {
  background: #ffffff !important;
  border-color: rgba(243, 128, 32, 0.48) !important;
  color: #0f172a !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06) !important;
}

html[data-nx-theme="light"] .nx-account-fallback {
  background: rgba(243, 128, 32, 0.14) !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .nx-notif-badge-dot {
  border-color: #ffffff !important;
}

/* Popovers de Notificaciones y Menú del Usuario */
html[data-nx-theme="light"] .nx-notif-panel,
html[data-nx-theme="light"] .nx-account-panel {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  color: #0f172a !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14) !important;
}

html[data-nx-theme="light"] .nx-notif-title,
html[data-nx-theme="light"] .nx-account-company {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nx-notif-desc,
html[data-nx-theme="light"] .nx-account-identity,
html[data-nx-theme="light"] .nx-account-help {
  color: #475569 !important;
}

html[data-nx-theme="light"] .nx-notif-pill,
html[data-nx-theme="light"] .nx-account-theme-badge {
  background: rgba(243, 128, 32, 0.12);
  color: #c2410c;
  border-color: rgba(243, 128, 32, 0.35);
}

html[data-nx-theme="light"] .nx-account-link {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.07);
  color: #1e293b;
}

html[data-nx-theme="light"] .nx-account-link:hover {
  background: rgba(243, 128, 32, 0.10);
  border-color: rgba(243, 128, 32, 0.34);
  color: #c2410c;
}

html[data-nx-theme="light"] .nx-account-logout {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.28);
  color: #be123c;
  font-weight: 600;
}

html[data-nx-theme="light"] .nx-account-logout:hover {
  background: rgba(244, 63, 94, 0.14);
}

/* Jerarquía tipográfica y cabeceras en Modo Claro */
html[data-nx-theme="light"] h1,
html[data-nx-theme="light"] h2,
html[data-nx-theme="light"] h3,
html[data-nx-theme="light"] h4,
html[data-nx-theme="light"] .page-title,
html[data-nx-theme="light"] .nwms-title,
html[data-nx-theme="light"] .nm-view-title,
html[data-nx-theme="light"] #module-title,
html[data-nx-theme="light"] #title,
html[data-nx-theme="light"] .nx-page-header h1,
html[data-nx-theme="light"] .module-view-header h1,
html[data-nx-theme="light"] .nwms-page-header h1,
html[data-nx-theme="light"] .page-heading h1,
html[data-nx-theme="light"] .section-header h1,
html[data-nx-theme="light"] .section-header h2,
html[data-nx-theme="light"] .card-title,
html[data-nx-theme="light"] .modal-title {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nx-page-header p,
html[data-nx-theme="light"] .module-view-header p,
html[data-nx-theme="light"] .nwms-page-header p,
html[data-nx-theme="light"] .page-heading p.subtitle,
html[data-nx-theme="light"] .section-header p,
html[data-nx-theme="light"] .muted,
html[data-nx-theme="light"] .help-text,
html[data-nx-theme="light"] .page-help,
html[data-nx-theme="light"] .nwms-subtitle,
html[data-nx-theme="light"] #subtitle,
html[data-nx-theme="light"] #module-help,
html[data-nx-theme="light"] #list-help {
  color: #475569 !important;
}

/* Sidebar Desktop, Árbol Unificado y Drawer Móvil */
html[data-nx-theme="light"] .module-sidebar,
html[data-nx-theme="light"] .sidebar,
html[data-nx-theme="light"] .nwms-sidebar,
html[data-nx-theme="light"] .nm-sidebar {
  background: #ffffff !important;
  border-right: 1px solid rgba(15, 23, 42, 0.09) !important;
}

html[data-nx-theme="light"] .nx-sys-section-label {
  color: #475569 !important;
}

html[data-nx-theme="light"] .nx-sys-mod-group.is-active-module {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-nx-theme="light"] .nx-sys-mod-btn,
html[data-nx-theme="light"] .module-nav-button,
html[data-nx-theme="light"] .nwms-nav-btn,
html[data-nx-theme="light"] .nav-item {
  color: #334155 !important;
}

html[data-nx-theme="light"] .nx-sys-mod-btn:hover,
html[data-nx-theme="light"] .module-nav-button:hover,
html[data-nx-theme="light"] .nwms-nav-btn:hover,
html[data-nx-theme="light"] .nav-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nx-sys-mod-btn.active,
html[data-nx-theme="light"] .module-nav-button.active,
html[data-nx-theme="light"] .nwms-nav-btn.active,
html[data-nx-theme="light"] .nav-item.active {
  background: rgba(243, 128, 32, 0.14) !important;
  border-color: rgba(243, 128, 32, 0.38) !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .nx-sys-sub-item {
  color: #475569 !important;
}

html[data-nx-theme="light"] .nx-sys-sub-item:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nx-sys-sub-item.active {
  background: rgba(243, 128, 32, 0.12) !important;
  color: #c2410c !important;
}

/* Navegación Móvil Inferior y Subtabs */
html[data-nx-theme="light"] .nx-mobile-subtabs {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(15, 23, 42, 0.09);
}

html[data-nx-theme="light"] .nx-mobile-subtab-btn,
html[data-nx-theme="light"] .nx-subtab-trigger {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
  color: #1e293b !important;
}

html[data-nx-theme="light"] .nx-mobile-subtab-btn.active {
  background: #f38020 !important;
  border-color: #f38020 !important;
  color: #ffffff !important;
}

html[data-nx-theme="light"] .nx-subtab-trigger.is-active,
html[data-nx-theme="light"] .nx-subtab-more[open] .nx-subtab-trigger {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .nx-subtab-menu {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
}

html[data-nx-theme="light"] .nx-universal-bottom-nav,
html[data-nx-theme="light"] .mobile-bottom-nav,
html[data-nx-theme="light"] .module-mobile-nav,
html[data-nx-theme="light"] .nwms-mobile-nav {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top: 1px solid rgba(15, 23, 42, 0.10) !important;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06) !important;
}

html[data-nx-theme="light"] .nx-bottom-nav-item {
  color: #475569;
}

html[data-nx-theme="light"] .nx-bottom-nav-item:hover {
  color: #0f172a;
}

html[data-nx-theme="light"] .nx-bottom-nav-item.active {
  color: #c2410c;
}

html[data-nx-theme="light"] .nx-drawer-backdrop {
  background: rgba(15, 23, 42, 0.42) !important;
}

@media (max-width: 900px) {
  html[data-nx-theme="light"] .module-sidebar,
  html[data-nx-theme="light"] .sidebar,
  html[data-nx-theme="light"] .nwms-sidebar,
  html[data-nx-theme="light"] .nm-sidebar {
    background: #ffffff !important;
    border-right: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: 14px 0 38px rgba(15, 23, 42, 0.18) !important;
  }
}

/* Tarjetas, Tablas, Controles y Modales */
html[data-nx-theme="light"] .card,
html[data-nx-theme="light"] .module-card,
html[data-nx-theme="light"] .nwms-card,
html[data-nx-theme="light"] .nwms-kpi-card,
html[data-nx-theme="light"] .panel,
html[data-nx-theme="light"] .support-card,
html[data-nx-theme="light"] .mod-card,
html[data-nx-theme="light"] .plan-card,
html[data-nx-theme="light"] .template-card,
html[data-nx-theme="light"] .additional-fields {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.10);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

html[data-nx-theme="light"] .nwms-kpi-icon {
  background: rgba(243, 128, 32, 0.10);
}

html[data-nx-theme="light"] table {
  background: #ffffff;
}

html[data-nx-theme="light"] th,
html[data-nx-theme="light"] .table-th,
html[data-nx-theme="light"] .nwms-table th {
  background: #f8fafc !important;
  color: #475569 !important;
  border-bottom-color: rgba(15, 23, 42, 0.10) !important;
}

html[data-nx-theme="light"] td,
html[data-nx-theme="light"] .table-td,
html[data-nx-theme="light"] .nwms-table td {
  color: #0f172a;
  border-bottom-color: rgba(15, 23, 42, 0.07);
}

html[data-nx-theme="light"] tbody tr:hover,
html[data-nx-theme="light"] tbody tr:hover td {
  background: #f8fafc;
}

html[data-nx-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html[data-nx-theme="light"] select,
html[data-nx-theme="light"] textarea,
html[data-nx-theme="light"] .form-control,
html[data-nx-theme="light"] .nwms-input,
html[data-nx-theme="light"] .nwms-select,
html[data-nx-theme="light"] .nwms-textarea,
html[data-nx-theme="light"] .nap-input,
html[data-nx-theme="light"] .nap-select,
html[data-nx-theme="light"] .settings-mobile-select-control {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  color-scheme: light !important;
}

html[data-nx-theme="light"] input:focus,
html[data-nx-theme="light"] select:focus,
html[data-nx-theme="light"] textarea:focus,
html[data-nx-theme="light"] .form-control:focus {
  border-color: #f38020 !important;
}

html[data-nx-theme="light"] select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .secondary,
html[data-nx-theme="light"] .module-topbar .module-hub-link,
html[data-nx-theme="light"] .btn:not(.btn-primary):not(.btn-green):not(.btn-red):not(.btn-blue):not(.btn-danger):not(.primary) {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
}

html[data-nx-theme="light"] .secondary:hover,
html[data-nx-theme="light"] .btn:not(.btn-primary):not(.btn-green):not(.btn-red):not(.btn-blue):not(.btn-danger):not(.primary):hover {
  background: #f1f5f9;
  border-color: rgba(243, 128, 32, 0.45);
  color: #0f172a;
}

html[data-nx-theme="light"] .btn-green {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

html[data-nx-theme="light"] .btn-red {
  background: rgba(244, 63, 94, 0.10);
  border-color: rgba(244, 63, 94, 0.35);
  color: #be123c;
}

html[data-nx-theme="light"] .btn-blue {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.35);
  color: #0369a1;
}

/* Modales, Diálogos y Popovers de Ayuda */
html[data-nx-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.45) !important;
}

html[data-nx-theme="light"] .modal-window,
html[data-nx-theme="light"] .modal-content,
html[data-nx-theme="light"] dialog {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.20) !important;
}

html[data-nx-theme="light"] .modal-window .modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid rgba(15, 23, 42, 0.10) !important;
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.05) !important;
}

html[data-nx-theme="light"] .nx-info-popover {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(194, 65, 12, 0.48);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

html[data-nx-theme="light"] .nx-info-pop-head {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-nx-theme="light"] .nx-info-pop-title {
  color: #0f172a;
}

html[data-nx-theme="light"] .nx-info-pop-desc {
  color: #1e293b;
}

html[data-nx-theme="light"] .nx-info-pop-rule {
  color: #7c2d12;
}

html[data-nx-theme="light"] .nx-info-pop-rule strong {
  color: #c2410c;
}

html[data-nx-theme="light"] .nx-info-pop-example {
  background: #ecfdf5;
  border-color: #86efac;
  color: #064e3b;
}

html[data-nx-theme="light"] .module-badge,
html[data-nx-theme="light"] .badge-orange {
  color: #c2410c;
  background: rgba(243, 128, 32, 0.12);
  border-color: rgba(243, 128, 32, 0.32);
}

html[data-nx-theme="light"] .badge-green {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

html[data-nx-theme="light"] .badge-amber {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

html[data-nx-theme="light"] .badge-dark,
html[data-nx-theme="light"] .cat-quick-chip {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

html[data-nx-theme="light"] .cat-quick-chip:hover {
  background: rgba(243, 128, 32, 0.12);
  border-color: rgba(243, 128, 32, 0.40);
  color: #c2410c;
}

html[data-nx-theme="light"] .cat-quick-chip.active {
  background: #f38020;
  border-color: #f38020;
  color: #07090e;
}

/* CRM, Ajustes internos, Agenda, Insumos y Probador */
html[data-nx-theme="light"] .settings-option-item {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.09);
}

html[data-nx-theme="light"] .settings-option-item .opt-name,
html[data-nx-theme="light"] .nap-label,
html[data-nx-theme="light"] .nx-cs-title,
html[data-nx-theme="light"] .nx-cs-qty {
  color: #0f172a;
}

html[data-nx-theme="light"] .nx-cs-switch,
html[data-nx-theme="light"] .nx-cs-log li,
html[data-nx-theme="light"] .nx-cs-ob {
  color: #334155;
}

html[data-nx-theme="light"] .settings-option-item.active .opt-name,
html[data-nx-theme="light"] .settings-option-item.active .opt-status {
  color: #c2410c;
}

html[data-nx-theme="light"] .pro-upsell-card {
  background: linear-gradient(135deg, rgba(243, 128, 32, 0.10), #ffffff);
}

html[data-nx-theme="light"] .nx-tl-col {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-nx-theme="light"] .nx-tl-line {
  background: rgba(15, 23, 42, 0.06);
}

html[data-nx-theme="light"] .nx-tl-lunch {
  color: #475569;
  background: repeating-linear-gradient(135deg, #f1f5f9 0 6px, #e2e8f0 6px 12px);
}

html[data-nx-theme="light"] .nx-tl-free {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.45);
}

html[data-nx-theme="light"] .nx-tl-cita.is-done {
  background: #ffedd5;
  border-color: rgba(243, 128, 32, 0.40);
  color: #7c2d12;
}

html[data-nx-theme="light"] #bcpCard pre.bcp-pre,
html[data-nx-theme="light"] .log-terminal {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

html[data-nx-theme="light"] .session-resilience-banner,
html[data-nx-theme="light"] .session-resilience-banner .session-resilience-left {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

/* Copiloto Flotante NexIA en Modo Claro */
html[data-nx-theme="light"] .nxc-fab-btn {
  background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
  color: #0f172a;
  border-color: rgba(243, 128, 32, 0.55);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(243, 128, 32, 0.12);
}

html[data-nx-theme="light"] .nxc-fab-title {
  color: #0f172a;
}

html[data-nx-theme="light"] .nxc-fab-sub {
  color: #c2410c;
}

html[data-nx-theme="light"] .nxc-panel {
  background: #ffffff;
  border-color: rgba(243, 128, 32, 0.38);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.20);
}

html[data-nx-theme="light"] .nxc-header {
  background: linear-gradient(180deg, rgba(243, 128, 32, 0.12) 0%, #ffffff 100%);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-nx-theme="light"] .nxc-title {
  color: #0f172a;
}

html[data-nx-theme="light"] .nxc-mode-bar {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-nx-theme="light"] .nxc-mode-btn {
  color: #475569;
}

html[data-nx-theme="light"] .nxc-mode-btn.active.mode-tenant {
  color: #047857;
}

html[data-nx-theme="light"] .nxc-mode-btn.active.mode-admin {
  color: #c2410c;
}

html[data-nx-theme="light"] .nxc-context-bar {
  background: #f8fafc;
  border-bottom-color: rgba(15, 23, 42, 0.08);
  color: #475569;
}

html[data-nx-theme="light"] .nxc-ctx-item b {
  color: #0f172a;
}

html[data-nx-theme="light"] .nxc-msg.assistant {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.10);
  color: #0f172a;
}

html[data-nx-theme="light"] .nxc-msg.assistant code {
  background: rgba(243, 128, 32, 0.10);
  color: #c2410c;
}

html[data-nx-theme="light"] .nxc-msg.assistant pre {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

html[data-nx-theme="light"] .nxc-msg.assistant pre code {
  color: #0f172a;
}

html[data-nx-theme="light"] .nxc-chips,
html[data-nx-theme="light"] .nxc-input-area {
  background: #f8fafc;
  border-top-color: rgba(15, 23, 42, 0.08);
}

html[data-nx-theme="light"] .nxc-chip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

html[data-nx-theme="light"] .nxc-chip:hover {
  background: rgba(243, 128, 32, 0.12);
  border-color: rgba(243, 128, 32, 0.45);
  color: #c2410c;
}

html[data-nx-theme="light"] ::-webkit-scrollbar-track {
  background: transparent;
}

html[data-nx-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.32);
}

/* ============================================================================
 * NX-UI-THEME-002: Viñetas internas, Hero Cards, DTE, POS, Catálogo y Listboxes
 * ============================================================================ */

/* Listboxes nativos (<select>, <option>, <optgroup>) y estados focus/checked */
html[data-nx-theme="light"] select,
html[data-nx-theme="light"] .tenant-select,
html[data-nx-theme="light"] .form-control,
html[data-nx-theme="light"] .table-plan-select,
html[data-nx-theme="light"] .table-sub-select,
html[data-nx-theme="light"] .nwms-select,
html[data-nx-theme="light"] .nap-select,
html[data-nx-theme="light"] .settings-mobile-select-control {
  color-scheme: light !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .tenant-selector-wrap {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] select option,
html[data-nx-theme="light"] select optgroup,
html[data-nx-theme="light"] .tenant-select option,
html[data-nx-theme="light"] .form-control option,
html[data-nx-theme="light"] .nwms-select option,
html[data-nx-theme="light"] .nap-select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
  color-scheme: light !important;
}

html[data-nx-theme="light"] select option:checked,
html[data-nx-theme="light"] .tenant-select option:checked,
html[data-nx-theme="light"] .form-control option:checked,
html[data-nx-theme="light"] .nwms-select option:checked,
html[data-nx-theme="light"] .nap-select option:checked {
  background-color: #ffedd5 !important;
  color: #9a3412 !important;
}

html[data-nx-theme="light"] .form-control:focus,
html[data-nx-theme="light"] input:focus,
html[data-nx-theme="light"] select:focus,
html[data-nx-theme="light"] textarea:focus {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #f38020 !important;
}

/* Home Evolutivo (hub.html) y Cabeceras Hero (Estilo Nexus Trading) */
html[data-nx-theme="light"] .hub-hero-card,
html[data-nx-theme="light"] .home-hero-card,
html[data-nx-theme="light"] .settings-master-header {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%) !important;
  border: 1px solid #fed7aa !important;
  box-shadow: 0 2px 10px rgba(243, 128, 32, 0.06) !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .hub-hero-title {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .hub-hero-subtitle {
  color: #475569 !important;
}

html[data-nx-theme="light"] .hub-hero-badge,
html[data-nx-theme="light"] .plan-card .plan-badge {
  background: rgba(243, 128, 32, 0.14) !important;
  color: #c2410c !important;
  border-color: rgba(243, 128, 32, 0.35) !important;
}

html[data-nx-theme="light"] .hub-widget-card {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

html[data-nx-theme="light"] .hub-widget-card:hover {
  border-color: rgba(243, 128, 32, 0.45) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(243, 128, 32, 0.10) !important;
}

html[data-nx-theme="light"] .hub-widget-title {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .hub-widget-kpis {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-nx-theme="light"] .hub-kpi-label {
  color: #475569 !important;
}

html[data-nx-theme="light"] .hub-kpi-value {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .hub-widget-badge {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .hub-widget-badge.badge-online {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #047857 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

html[data-nx-theme="light"] .hub-widget-badge.badge-alert {
  background: rgba(245, 158, 11, 0.14) !important;
  color: #b45309 !important;
  border-color: rgba(245, 158, 11, 0.38) !important;
}

html[data-nx-theme="light"] .hub-widget-actions a.hub-sublink {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-nx-theme="light"] .hub-widget-actions a.hub-sublink:hover {
  background: #fff7ed !important;
  color: #c2410c !important;
  border-color: rgba(243, 128, 32, 0.45) !important;
}

html[data-nx-theme="light"] .home-acc-body {
  background: #f8fafc !important;
  border-top-color: #e2e8f0 !important;
}

/* Facturación Electrónica DTE (/facturacion y Estudio) */
html[data-nx-theme="light"] .dte-status-strip {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

html[data-nx-theme="light"] .dte-status-strip.is-ready {
  border-color: rgba(22, 163, 74, 0.42) !important;
}

html[data-nx-theme="light"] .dte-status-strip.is-pending {
  border-color: rgba(243, 128, 32, 0.42) !important;
}

html[data-nx-theme="light"] .dte-strip-name {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .dte-optional-drawer {
  background: #fff7ed !important;
  border-color: rgba(243, 128, 32, 0.48) !important;
}

html[data-nx-theme="light"] .dte-optional-drawer > summary {
  color: #c2410c !important;
}

html[data-nx-theme="light"] .dte-optional-drawer > summary::after {
  color: #475569 !important;
}

html[data-nx-theme="light"] .dte-optional-drawer[open] > summary {
  border-bottom-color: rgba(243, 128, 32, 0.22) !important;
}

html[data-nx-theme="light"] .dte-optional-body {
  background: #ffffff !important;
}

html[data-nx-theme="light"] .dte-item-row {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

html[data-nx-theme="light"] .dte-item-badge,
html[data-nx-theme="light"] .dte-tax-pill {
  background: rgba(243, 128, 32, 0.14) !important;
  color: #c2410c !important;
  border-color: rgba(243, 128, 32, 0.35) !important;
}

html[data-nx-theme="light"] .dte-item-sub-pill {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-nx-theme="light"] .dte-item-opt-drawer > summary {
  color: #475569 !important;
}

html[data-nx-theme="light"] .dte-item-opt-drawer > summary:hover {
  color: #c2410c !important;
}

html[data-nx-theme="light"] .dte-item-opt-grid {
  border-top-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .dte-totals-bar {
  background: #fff7ed !important;
  border: 1px solid rgba(243, 128, 32, 0.42) !important;
}

html[data-nx-theme="light"] .dte-total-line {
  color: #334155 !important;
}

html[data-nx-theme="light"] .dte-total-grand {
  color: #c2410c !important;
}

html[data-nx-theme="light"] .dte-ret-wrap {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-nx-theme="light"] .dte-ret-wrap label {
  color: #1e293b !important;
}

html[data-nx-theme="light"] .dte-collapsible,
html[data-nx-theme="light"] .dte-filters-drawer {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] .dte-collapsible > summary {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .dte-filters-drawer > summary {
  color: #c2410c !important;
}

html[data-nx-theme="light"] .dte-collapsible[open] > summary,
html[data-nx-theme="light"] .dte-filters-drawer[open] > summary {
  border-bottom-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] .dte-client-header {
  border-top-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] .dte-customer-badge {
  color: #c2410c !important;
}

/* Buscadores / Listboxes personalizados de DTE y menús desplegables de acciones */
html[data-nx-theme="light"] .dte-picker-option {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .dte-picker-option:hover,
html[data-nx-theme="light"] .dte-picker-option:focus-visible {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #9a3412 !important;
}

html[data-nx-theme="light"] .dte-more-actions > summary,
html[data-nx-theme="light"] .dte-actions-dropdown > summary {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

html[data-nx-theme="light"] .dte-more-actions > summary:hover,
html[data-nx-theme="light"] .dte-actions-dropdown > summary:hover,
html[data-nx-theme="light"] .dte-actions-dropdown[open] > summary {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .dte-actions-dropdown > .dte-more-actions-menu {
  background: #ffffff !important;
  border-color: rgba(243, 128, 32, 0.42) !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14) !important;
}

html[data-nx-theme="light"] .dte-more-actions-menu {
  border-top-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .dte-tpl-card {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .dte-tpl-card strong {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .dte-tpl-card.active {
  background: #fff7ed !important;
  border-color: #f38020 !important;
}

html[data-nx-theme="light"] .dte-color-chip {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

html[data-nx-theme="light"] .dte-color-chip.active {
  border-color: #f38020 !important;
  background: #fff7ed !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .dte-channel-pill {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html[data-nx-theme="light"] .dte-channel-pill.is-ok {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #047857 !important;
}

html[data-nx-theme="light"] .dte-channel-pill.is-warn {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(245, 158, 11, 0.38) !important;
  color: #b45309 !important;
}

html[data-nx-theme="light"] .dte-client-contact-line,
html[data-nx-theme="light"] .dte-delivery-mini {
  color: #475569 !important;
}

html[data-nx-theme="light"] .dte-delivery-mini.is-wa { color: #047857 !important; }
html[data-nx-theme="light"] .dte-delivery-mini.is-mail { color: #0369a1 !important; }
html[data-nx-theme="light"] .dte-delivery-mini.is-err { color: #be123c !important; }

html[data-nx-theme="light"] .dte-reject-summary {
  background: rgba(244, 63, 94, 0.10) !important;
  border-color: rgba(244, 63, 94, 0.30) !important;
  color: #be123c !important;
}

html[data-nx-theme="light"] .mob-card-row {
  border-bottom-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] .detail-slide {
  background: #f1f5f9 !important;
}

html[data-nx-theme="light"] .studio-bottom-nav {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top-color: rgba(15, 23, 42, 0.10) !important;
}

/* Agenda Timeline Sheet y Selectores de Servicios/Insumos */
html[data-nx-theme="light"] .nx-tl-sheet {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 -10px 34px rgba(15, 23, 42, 0.16) !important;
}

html[data-nx-theme="light"] .nx-tl-head {
  background: #ffffff !important;
  border-bottom-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] .nx-tl-fact,
html[data-nx-theme="light"] .nx-tl-option,
html[data-nx-theme="light"] .nx-tl-supply {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .nx-tl-option.is-selected {
  background: #fff7ed !important;
  border-color: #f38020 !important;
}

html[data-nx-theme="light"] .nx-tl-option-meta {
  color: #c2410c !important;
}

html[data-nx-theme="light"] .nx-tl-input,
html[data-nx-theme="light"] .nx-tl-supply-qty {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .agenda-slot-detail-cell {
  background: #f8fafc !important;
  border-bottom-color: rgba(243, 128, 32, 0.28) !important;
}

html[data-nx-theme="light"] .agenda-cupo-client {
  color: #0f172a !important;
}

/* POS / Pedidos, Catálogo Admin, Ajustes CRM y Modales */
html[data-nx-theme="light"] .pos-catalog-picker-card,
html[data-nx-theme="light"] .pos-cart-items-box,
html[data-nx-theme="light"] .pos-collapsible-discount-wrap,
html[data-nx-theme="light"] .pos-financial-summary {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .pos-catalog-pill,
html[data-nx-theme="light"] .pos-mini-chip {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

html[data-nx-theme="light"] .pos-catalog-pill:hover,
html[data-nx-theme="light"] .pos-mini-chip:hover {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .pos-qty-stepper,
html[data-nx-theme="light"] .pos-disc-type-toggle,
html[data-nx-theme="light"] .pos-collapsible-discount-body {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .pos-qty-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-nx-theme="light"] .pos-sum-row,
html[data-nx-theme="light"] .pos-collapsible-discount-toggle:hover {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .pos-delivery-mode-btn.active {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .catalog-product-card .card-thumb,
html[data-nx-theme="light"] #prodImgPreview {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] .catalog-product-card .card-sku {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

html[data-nx-theme="light"] .catalog-product-card .card-title,
html[data-nx-theme="light"] .price-main {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .catalog-product-card .btn-card-action,
html[data-nx-theme="light"] .catalog-product-card .btn-card-edit,
html[data-nx-theme="light"] .btn-secondary {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

html[data-nx-theme="light"] .catalog-product-card .btn-card-action:hover,
html[data-nx-theme="light"] .catalog-product-card .btn-card-edit:hover,
html[data-nx-theme="light"] .btn-secondary:hover {
  background: #f1f5f9 !important;
  border-color: rgba(243, 128, 32, 0.45) !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .settings-tab-pill {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html[data-nx-theme="light"] .settings-tab-pill:hover {
  background: #f8fafc !important;
  border-color: rgba(243, 128, 32, 0.45) !important;
  color: #0f172a !important;
}

html[data-nx-theme="light"] .settings-tab-pill.active {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .settings-mobile-nav {
  background: #ffffff !important;
  border-color: rgba(243, 128, 32, 0.38) !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
}

html[data-nx-theme="light"] .btn-toggle-options-list {
  background: #fff7ed !important;
  border-color: rgba(243, 128, 32, 0.42) !important;
  color: #c2410c !important;
}

html[data-nx-theme="light"] .settings-options-list {
  border-top-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] [data-skin-card] {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] #appearanceLogoBox,
html[data-nx-theme="light"] #appearanceBannerBox {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html[data-nx-theme="light"] #appearanceBannerPlaceholder {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1;
}

html[data-nx-theme="light"] #clinicStationNavBar {
  background: #f0fdf4 !important;
  border-color: rgba(16, 185, 129, 0.40) !important;
}

html[data-nx-theme="light"] .preset-pill-text strong {
  color: #0f172a !important;
}

html[data-nx-theme="light"] .wizard-stepper {
  background: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}

html[data-nx-theme="light"] .switch-slider {
  background-color: #cbd5e1;
}

html[data-nx-theme="light"] #bcpCard .bcp-m-IDLE,
html[data-nx-theme="light"] #bcpCard .bcp-notice,
html[data-nx-theme="light"] .chat-system-notice {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0;
}

html[data-nx-theme="light"] .modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid rgba(15, 23, 42, 0.10) !important;
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.04) !important;
}

/* === NX-HOME-001: HOME MODULAR & MODO CLARO === */
.hub-customize-btn,
.hub-reset-btn,
.hub-edit-icon-btn,
.hub-edit-hide-btn,
.hub-restore-chip,
.hub-footnote-btn,
.hub-widget-chips a.hub-sublink {
  min-height: 30px !important;
  font-size: 0.75rem !important;
  padding: 5px 10px !important;
}
@media (max-width: 800px) {
  .hub-customize-btn,
  .hub-reset-btn,
  .hub-edit-icon-btn,
  .hub-edit-hide-btn,
  .hub-restore-chip,
  .hub-footnote-btn,
  .hub-widget-chips a.hub-sublink {
    min-height: 36px !important;
    font-size: 0.76rem !important;
  }
}

html[data-nx-theme="light"] .hub-ticker-shell {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}
html[data-nx-theme="light"] .hub-ticker-item {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
html[data-nx-theme="light"] .hub-ticker-label {
  color: #475569 !important;
}
html[data-nx-theme="light"] .hub-ticker-val {
  color: #0f172a !important;
}
html[data-nx-theme="light"] .hub-ticker-tag {
  background: #e2e8f0 !important;
  color: #334155 !important;
}
html[data-nx-theme="light"] .hub-ticker-tag.is-up,
html[data-nx-theme="light"] .hub-ticker-tag.is-good {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #047857 !important;
}
html[data-nx-theme="light"] .hub-ticker-tag.is-down {
  background: rgba(244, 63, 94, 0.12) !important;
  color: #be123c !important;
}
html[data-nx-theme="light"] .hub-ticker-tag.is-warn {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #b45309 !important;
}
html[data-nx-theme="light"] .hub-ticker-tag.is-live {
  background: rgba(243, 128, 32, 0.15) !important;
  color: #c2410c !important;
}
html[data-nx-theme="light"] .hub-ticker-speed {
  background: #fff7ed !important;
  border-color: rgba(243, 128, 32, 0.4) !important;
  color: #c2410c !important;
}
html[data-nx-theme="light"] .hub-clock-pill {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}
html[data-nx-theme="light"] .hub-customize-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
html[data-nx-theme="light"] .hub-customize-btn.is-active {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}
html[data-nx-theme="light"] .hub-customizer-panel {
  background: #ffffff !important;
  border-color: rgba(243, 128, 32, 0.35) !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05) !important;
}
html[data-nx-theme="light"] .hub-customizer-label,
html[data-nx-theme="light"] .hub-customizer-hint {
  color: #475569 !important;
}
html[data-nx-theme="light"] .hub-toggle-chip {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
html[data-nx-theme="light"] .hub-toggle-chip.is-on {
  background: #fff7ed !important;
  border-color: #f38020 !important;
  color: #c2410c !important;
}
html[data-nx-theme="light"] .hub-card-arrow {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}
html[data-nx-theme="light"] .hub-widget-card.is-clickable:hover .hub-card-arrow {
  background: #fff7ed !important;
  border-color: rgba(243, 128, 32, 0.45) !important;
  color: #c2410c !important;
}
html[data-nx-theme="light"] .hub-edit-toolbar {
  border-top-color: #e2e8f0 !important;
}
html[data-nx-theme="light"] .hub-hidden-tray,
html[data-nx-theme="light"] .hub-empty-notice {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

/* === NX-ZERO-FLASH-NAV === */
#sidebarNavOperativo > :not(.nx-unified-nav-list),
#sidebarNavAjustes,
#settingsMasterHeader,
#trialCountdownBanner,
#homeHeroPlanBadge,
#trial-banner,
.nwms-sidebar > :not(.nx-unified-nav-list),
#nmSidebar > :not(.nx-unified-nav-list),
.nexus-hr-shell .sidebar .workspace-label,
.nexus-hr-shell .sidebar > h2,
.nexus-hr-shell .sidebar .sidebar-bottom {
  display: none !important;
}
.nexus-hr-shell .sidebar {
  padding: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
@media (max-width: 900px) {
  #nmBottomNav, .nm-bottom-nav {
    display: none !important;
  }
}
html[data-nx-boot-view] .view-panel,
html[data-nx-boot-view] .nwms-view,
html[data-nx-boot-view] .nm-view {
  display: none !important;
}
html[data-nx-boot-view="view-qr"] #view-qr,
html[data-nx-boot-view="view-ai"] #view-ai,
html[data-nx-boot-view="view-menu"] #view-menu,
html[data-nx-boot-view="view-alerts"] #view-alerts,
html[data-nx-boot-view="view-simulator"] #view-simulator,
html[data-nx-boot-view="view-fields"] #view-fields,
html[data-nx-boot-view="view-analytics"] #view-analytics,
html[data-nx-boot-view="view-appointments"] #view-appointments,
html[data-nx-boot-view="view-catalog"] #view-catalog,
html[data-nx-boot-view="view-delivery"] #view-delivery,
html[data-nx-boot-view="view-appearance"] #view-appearance,
html[data-nx-boot-view="view-admin"] #view-admin,
html[data-nx-boot-view="view-botcore-probador"] #view-botcore-probador,
html[data-nx-boot-view="view-plan-settings"] #view-plan-settings,
html[data-nx-boot-view="view-erp-settings"] #view-erp-settings,
html[data-nx-boot-view="view-stock"] #view-stock,
html[data-nx-boot-view="view-invoice"] #view-invoice,
html[data-nx-boot-view="view-issues"] #view-issues,
html[data-nx-boot-view="view-po"] #view-po,
html[data-nx-boot-view="view-kardex"] #view-kardex,
html[data-nx-boot-view="view-catalogs"] #view-catalogs,
html[data-nx-boot-view="view-home"] #view-home,
html[data-nx-boot-view="view-tasks"] #view-tasks,
html[data-nx-boot-view="view-mechanics"] #view-mechanics,
html[data-nx-boot-view="view-orders"] #view-orders,
html[data-nx-boot-view="view-calendar"] #view-calendar,
html[data-nx-boot-view="view-extra"] #view-extra,
html[data-nx-boot-view="view-machines"] #view-machines,
html[data-nx-boot-view="view-history"] #view-history,
html[data-nx-boot-view="view-master-table"] #view-master-table {
  display: block !important;
}

/* === NX-APP-SHELL-SPA-001: Transición Congelada + Barra Única Inteligente + Modo Embebido === */
@view-transition {
  navigation: auto;
}
.module-topbar, .topbar, .nwms-topbar, .nm-topbar {
  view-transition-name: nx-topbar;
}
.module-sidebar, .sidebar, .nwms-sidebar, .nm-sidebar {
  view-transition-name: nx-sidebar;
}
#nexus-account-menu {
  min-width: 76px;
  min-height: 36px;
}
@media (max-width: 900px) {
  .nx-mobile-subtabs {
    min-height: 42px;
  }
  .nx-mobile-subtabs:empty {
    min-height: 42px;
  }
}

/* Barra única superior retardada (>140ms): nunca se duplica, no tapa la pantalla */
#nxTopProgress {
  position: fixed;
  top: 58px;
  left: 0;
  right: 0;
  height: 2.5px;
  z-index: 1400;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease-out;
  overflow: hidden;
}
#nxTopProgress .nx-top-progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f38020 0%, #fb923c 65%, #fdba74 100%);
  box-shadow: 0 0 10px rgba(243, 128, 32, 0.55);
  transform-origin: left center;
  transform: scaleX(0);
}
#nxTopProgress.is-active {
  opacity: 1;
}
#nxTopProgress.is-active .nx-top-progress-fill {
  animation: nx-top-bar-crawl 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
#nxTopProgress.is-finishing {
  opacity: 0;
  transition: opacity 200ms ease-out 70ms;
}
#nxTopProgress.is-finishing .nx-top-progress-fill {
  transform: scaleX(1);
  transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes nx-top-bar-crawl {
  0% { transform: scaleX(0.06); }
  45% { transform: scaleX(0.62); }
  100% { transform: scaleX(0.86); }
}

/* Compatibilidad inocua por si queda un nodo legacy #nxTransitionVeil en alguna vista en caché */
#nxTransitionVeil {
  display: none !important;
  pointer-events: none !important;
}

/* Escenario unificado del App Shell (nativo + módulos HTML desplegados sobre la plantilla) */
.nx-stage-host {
  position: relative;
  min-width: 0;
  min-height: calc(100dvh - 58px);
}
body.nx-frame-mode .nx-stage-host {
  height: calc(100dvh - 58px);
  overflow: hidden;
}
#nx-native-stage {
  position: relative;
  z-index: 1;
}
#nx-native-stage.is-hidden-layer {
  display: none !important;
}

.nx-stage-frames {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
body.nx-frame-mode .nx-stage-frames {
  pointer-events: auto;
}
.nx-mod-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg-body, #07090e);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1;
}
html[data-nx-theme="light"] .nx-mod-frame {
  background: #f8fafc;
}
.nx-mod-frame.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

/* Cortina de reveal: solo aparece en fotograma 1 (cuando la nueva vista ya está 100% lista) y se desvanece */
#nxStageCurtain,
.nx-stage-curtain {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: var(--bg-body, #07090e);
  opacity: 0;
  visibility: hidden;
}
html[data-nx-theme="light"] #nxStageCurtain,
html[data-nx-theme="light"] .nx-stage-curtain {
  background: #f8fafc;
}
#nxStageCurtain.is-solid {
  visibility: visible;
  opacity: 1;
  transition: none;
}
#nxStageCurtain.is-revealing {
  visibility: visible;
  opacity: 0;
  transition: opacity 175ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nx-stage-frozen {
  pointer-events: none !important;
  cursor: progress;
}
@media (max-width: 900px) {
  body.nx-frame-mode {
    height: 100dvh;
    overflow: hidden !important;
    padding-bottom: 0 !important;
  }
  body.nx-frame-mode .nx-stage-host {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    height: auto;
    min-height: 0;
    z-index: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  #nxStageCurtain,
  .nx-stage-curtain {
    transition: none !important;
  }
}

/* === MODO EMBEBIDO (html.nx-embedded): Módulos HTML desplegados sin chrome duplicado === */
html.nx-embedded header.topbar,
html.nx-embedded header.module-topbar,
html.nx-embedded header.nwms-topbar,
html.nx-embedded header.nm-topbar,
html.nx-embedded aside.sidebar,
html.nx-embedded aside.module-sidebar,
html.nx-embedded aside.nwms-sidebar,
html.nx-embedded aside.nm-sidebar,
html.nx-embedded #module-mobile-nav,
html.nx-embedded #mobile-nav,
html.nx-embedded .nwms-mob-nav,
html.nx-embedded .nm-bottom-nav,
html.nx-embedded .nx-universal-bottom-nav,
html.nx-embedded #nxDrawerBackdrop,
html.nx-embedded #sidebarBackdrop,
html.nx-embedded #drawerBackdrop,
html.nx-embedded #nexusCopilotFab,
html.nx-embedded #nexusCopilotDrawer,
html.nx-embedded #nexusCopilotBackdrop,
html.nx-embedded #nxTransitionVeil {
  display: none !important;
}
html.nx-embedded,
html.nx-embedded body {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  height: auto !important;
  min-height: 100dvh !important;
  overflow-y: auto !important;
  overflow-x: clip !important;
  -webkit-overflow-scrolling: touch;
}
html.nx-embedded .module-layout,
html.nx-embedded .app-shell,
html.nx-embedded .app-container,
html.nx-embedded .workspace-layout,
html.nx-embedded .nwms-layout,
html.nx-embedded .nwms-shell,
html.nx-embedded .nm-shell {
  position: static !important;
  top: 0 !important;
  bottom: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: block !important;
  grid-template-columns: minmax(0, 1fr) !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  padding-top: 0 !important;
  min-height: 100dvh !important;
  width: 100% !important;
}
html.nx-embedded .module-main,
html.nx-embedded .main-stage,
html.nx-embedded .nwms-main,
html.nx-embedded .nm-main,
html.nx-embedded body.nexus-hr-shell main {
  position: static !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 100dvh !important;
  padding-bottom: 36px !important;
}
html.nx-embedded body.nexus-hr-shell {
  padding-left: 0 !important;
  display: block !important;
}
html.nx-embedded .ops-drawer {
  top: 0 !important;
  height: 100dvh !important;
}
html.nx-embedded .fl-drawer {
  top: 0 !important;
  height: 100dvh !important;
}
@media (max-width: 900px) {
  html.nx-embedded .module-main,
  html.nx-embedded .main-stage,
  html.nx-embedded .nwms-main,
  html.nx-embedded .nm-main,
  html.nx-embedded body.nexus-hr-shell main {
    padding-top: 10px !important;
    padding-bottom: 28px !important;
  }
  html.nx-embedded .catalog-basket-button {
    bottom: 14px !important;
  }
}


/* ==== Vista limpia y compactable de Pedidos (Catálogo -> Pedidos) ==== */
.nx-orders-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.nx-orders-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nx-order-filter-btn {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #121722;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nx-order-filter-btn.active {
  background: #f38020;
  border-color: #f38020;
  color: #ffffff;
  font-weight: 700;
}
.nx-order-count-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  background: rgba(0, 0, 0, 0.25);
}
.nx-orders-search {
  flex: 1 1 220px;
  max-width: 340px;
  min-height: 38px;
}
.nx-orders-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}
.nx-orders-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted, #94a3b8);
  border: 1px dashed rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  font-size: 0.88rem;
}
.nx-order-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-card, #111622);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.nx-order-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.nx-order-head-left {
  min-width: 0;
  flex: 1 1 210px;
}
.nx-order-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}
.nx-order-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fb923c;
}
.nx-order-client {
  font-size: 0.96rem;
  color: var(--text-main, #f8fafc);
  min-width: 0;
  overflow-wrap: anywhere;
}
.nx-order-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100%;
}
.nx-order-summary-line {
  margin-top: 4px;
  font-size: 0.81rem;
  line-height: 1.4;
  color: var(--text-muted, #94a3b8);
  white-space: normal;
  overflow-wrap: anywhere;
}
.nx-order-head-right {
  text-align: right;
  flex-shrink: 0;
}
.nx-order-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.08rem;
  color: var(--text-main, #f8fafc);
}
.nx-order-pay {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  text-transform: capitalize;
}
.nx-order-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nx-order-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.nx-order-act-btn {
  padding: 6px 12px !important;
  min-height: 34px !important;
  font-size: 0.8rem !important;
  border-radius: 8px !important;
}
.nx-order-details {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 8px;
}
.nx-order-details > summary {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}
.nx-order-details[open] > summary {
  color: #fb923c;
  margin-bottom: 8px;
}
.nx-order-details-body {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  font-size: 0.82rem;
}
.nx-order-detail-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 2px;
}
.nx-order-detail-val {
  white-space: pre-line;
  color: var(--text-main, #e2e8f0);
}
.nx-order-cancel-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
html[data-nx-theme="light"] .nx-order-filter-btn {
  background: #ffffff;
  color: #334155;
  border-color: rgba(15, 23, 42, 0.14);
}
html[data-nx-theme="light"] .nx-order-filter-btn.active {
  background: #f38020;
  color: #ffffff;
  border-color: #f38020;
}
html[data-nx-theme="light"] .nx-order-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-nx-theme="light"] .nx-order-details-body {
  background: #f8fafc;
}

/* === NX-NOTIF-001: Centro de Notificaciones Real, Preferencias Push & Toasts Dual-Theme === */
.nx-svg-inline {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  display: inline-block;
  vertical-align: middle;
}
.nx-account-link .nx-svg-inline {
  color: #f38020;
}
.nx-notif-trigger {
  position: relative;
}
.nx-notif-badge-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f38020;
  color: #07090e;
  border: 1.5px solid #0d1017;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(243, 128, 32, 0.4);
}
.nx-notif-badge-count.is-warning {
  background: #f59e0b;
  color: #07090e;
}
.nx-notif-badge-count.is-critical {
  background: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
}
.nx-notif-badge-count[hidden],
.nx-notif-badge-dot[hidden] {
  display: none !important;
}

.nx-notif-panel.nx-notif-center {
  width: min(392px, calc(100vw - 20px));
  max-height: min(78vh, 560px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  z-index: 1200;
  background: #0d1017;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65);
}

.nx-notif-top {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.nx-notif-top-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.nx-notif-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.nx-notif-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nx-notif-icon-btn:hover,
.nx-notif-icon-btn[aria-pressed="true"] {
  border-color: rgba(243, 128, 32, 0.5);
  background: rgba(243, 128, 32, 0.12);
  color: #f38020;
}
.nx-notif-icon-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.nx-notif-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}
.nx-notif-tab {
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nx-notif-tab:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
}
.nx-notif-tab.is-active {
  color: #f38020;
  background: rgba(243, 128, 32, 0.12);
  border-color: rgba(243, 128, 32, 0.35);
}

.nx-notif-push-bar {
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(243, 128, 32, 0.09);
  border-bottom: 1px solid rgba(243, 128, 32, 0.22);
  flex-shrink: 0;
}
.nx-notif-push-bar[hidden] { display: none !important; }
.nx-notif-push-text {
  font-size: 0.73rem;
  line-height: 1.3;
  color: #fed7aa;
  min-width: 0;
}
.nx-notif-push-btn {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 7px;
  border: none;
  background: #f38020;
  color: #07090e;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nx-notif-push-btn:hover { background: #fb923c; }
.nx-notif-push-btn:disabled { opacity: 0.6; cursor: wait; }

.nx-notif-trial-strip {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.24);
  font-size: 0.73rem;
  color: #fde68a;
  flex-shrink: 0;
}
.nx-notif-trial-strip.is-expired {
  background: rgba(239, 68, 68, 0.12);
  border-bottom-color: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}
.nx-notif-trial-strip[hidden] { display: none !important; }
.nx-notif-trial-link {
  color: #f38020;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.nx-notif-trial-link:hover { text-decoration: underline; }

.nx-notif-list {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 380px;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
.nx-notif-list::-webkit-scrollbar { width: 6px; }
.nx-notif-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}

.nx-notif-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  margin-bottom: 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nx-notif-item:last-child { margin-bottom: 0; }
.nx-notif-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(148, 163, 184, 0.14);
}
.nx-notif-item.is-unread {
  background: rgba(243, 128, 32, 0.07);
  border-color: rgba(243, 128, 32, 0.22);
  box-shadow: inset 3px 0 0 #f38020;
}

.nx-notif-icon-ring {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  flex-shrink: 0;
}
.nx-notif-icon-ring.sev-critical {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}
.nx-notif-icon-ring.sev-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}
.nx-notif-icon-ring.sev-success {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}
.nx-notif-icon-ring.sev-info {
  background: rgba(243, 128, 32, 0.15);
  color: #f38020;
}

.nx-notif-item-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nx-notif-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.28;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.nx-notif-item-body {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.nx-notif-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.68rem;
  color: #64748b;
}
.nx-notif-cat-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-weight: 600;
}
.nx-notif-dismiss-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.nx-notif-dismiss-btn:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.nx-notif-empty {
  padding: 28px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
}
.nx-notif-empty .nx-svg-inline {
  width: 28px;
  height: 28px;
  color: #f38020;
  opacity: 0.85;
}
.nx-notif-empty-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #e2e8f0;
}
.nx-notif-empty-sub {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.35;
}

.nx-notif-prefs {
  overflow-y: auto;
  max-height: 410px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.nx-notif-prefs[hidden] { display: none !important; }
.nx-notif-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 0.76rem;
  color: #e2e8f0;
}
.nx-notif-pref-row input[type="checkbox"] {
  accent-color: #f38020;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.nx-notif-pref-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.nx-notif-test-btn {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(243, 128, 32, 0.4);
  background: rgba(243, 128, 32, 0.12);
  color: #f38020;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}
.nx-notif-test-btn:hover { background: rgba(243, 128, 32, 0.22); }
.nx-notif-test-status {
  font-size: 0.72rem;
  color: #94a3b8;
  min-width: 0;
  word-break: break-word;
}
.nx-notif-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.nx-notif-cat-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.72rem;
  color: #cbd5e1;
  cursor: pointer;
  min-width: 0;
}
.nx-notif-cat-check input { accent-color: #f38020; flex-shrink: 0; }
.nx-notif-plan-box {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.nx-notif-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.nx-notif-plan-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e2e8f0;
}

.nx-live-toast-stack {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1300;
  pointer-events: none;
}
.nx-live-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: #131823;
  border: 1px solid rgba(243, 128, 32, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  color: #f8fafc;
  cursor: pointer;
}
.nx-live-toast.sev-critical {
  border-color: rgba(239, 68, 68, 0.55);
}
.nx-live-toast-title {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}
.nx-live-toast-body {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

@media (max-width: 768px) {
  .nx-live-toast-stack {
    bottom: 76px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* Modo Claro para Centro de Notificaciones & Toasts */
html[data-nx-theme="light"] .nx-notif-badge-count {
  border-color: #ffffff;
}
html[data-nx-theme="light"] .nx-notif-panel.nx-notif-center {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16) !important;
}
html[data-nx-theme="light"] .nx-notif-top {
  border-bottom-color: rgba(15, 23, 42, 0.09);
}
html[data-nx-theme="light"] .nx-notif-icon-btn {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
  color: #334155;
}
html[data-nx-theme="light"] .nx-notif-icon-btn:hover,
html[data-nx-theme="light"] .nx-notif-icon-btn[aria-pressed="true"] {
  background: rgba(243, 128, 32, 0.12);
  border-color: rgba(243, 128, 32, 0.45);
  color: #c2410c;
}
html[data-nx-theme="light"] .nx-notif-tabs {
  background: #f8fafc;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}
html[data-nx-theme="light"] .nx-notif-tab { color: #64748b; }
html[data-nx-theme="light"] .nx-notif-tab:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.04);
}
html[data-nx-theme="light"] .nx-notif-tab.is-active {
  color: #c2410c;
  background: rgba(243, 128, 32, 0.12);
  border-color: rgba(243, 128, 32, 0.35);
}
html[data-nx-theme="light"] .nx-notif-push-bar {
  background: rgba(243, 128, 32, 0.1);
}
html[data-nx-theme="light"] .nx-notif-push-text {
  color: #9a3412;
}
html[data-nx-theme="light"] .nx-notif-trial-strip {
  color: #92400e;
}
html[data-nx-theme="light"] .nx-notif-trial-strip.is-expired {
  color: #b91c1c;
}
html[data-nx-theme="light"] .nx-notif-item:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-nx-theme="light"] .nx-notif-item.is-unread {
  background: rgba(243, 128, 32, 0.07);
}
html[data-nx-theme="light"] .nx-notif-item-title,
html[data-nx-theme="light"] .nx-notif-empty-title,
html[data-nx-theme="light"] .nx-notif-plan-label {
  color: #0f172a;
}
html[data-nx-theme="light"] .nx-notif-item-body,
html[data-nx-theme="light"] .nx-notif-test-status {
  color: #475569;
}
html[data-nx-theme="light"] .nx-notif-cat-tag {
  background: #f1f5f9;
  color: #334155;
}
html[data-nx-theme="light"] .nx-notif-pref-row,
html[data-nx-theme="light"] .nx-notif-cat-check,
html[data-nx-theme="light"] .nx-notif-plan-box {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
  color: #1e293b;
}
html[data-nx-theme="light"] .nx-live-toast {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}
html[data-nx-theme="light"] .nx-live-toast-body {
  color: #475569;
}

/* ============================================================================
 * NX-UI-AUDIT-FIX-001: RESPONSIVO 320px, CONTROLES MOVILES >=16px/>=44px,
 * TABLAS MÓVILES <=800px, FOCUS VISIBLE & CONTRASTE AA (CLARO/OSCURO)
 * ============================================================================ */
.module-tabs [aria-current="page"] {
  color: #f38020;
  border-color: #f38020;
}
html[data-nx-theme="light"] .module-tabs [aria-current="page"] {
  color: #c2410c;
  border-color: #c2410c;
}

.field-checkbox:not([hidden]) {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-height: 44px !important;
  padding: 4px 0 !important;
  cursor: pointer !important;
}
.field-checkbox > input[type="checkbox"] {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  flex: 0 0 22px !important;
  accent-color: #f38020;
}

:is(button, a, summary, input, select, textarea, [role="button"], [tabindex="0"]):focus-visible {
  outline: 2px solid #f38020;
  outline-offset: 2px;
}

/* Contraste WCAG AA en Copiloto NexIA y Modo Claro/Oscuro */
.nxc-send-btn {
  background: #f38020 !important;
  color: #07090e !important;
}
.nxc-send-btn:hover {
  background: #ea580c !important;
  color: #07090e !important;
}
.nxc-send-btn.stop {
  background: #dc2626 !important;
  color: #ffffff !important;
}
html[data-nx-theme="light"] .nxc-textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html[data-nx-theme="light"] .nxc-textarea::placeholder {
  color: #475569 !important;
}
html[data-nx-theme="light"] .nxc-msg.user {
  background: #c2410c !important;
  color: #ffffff !important;
}
html[data-nx-theme="light"] .page-subtitle,
html[data-nx-theme="light"] .muted,
html[data-nx-theme="light"] .nwms-subtitle,
html[data-nx-theme="light"] .nwms-label,
html[data-nx-theme="light"] .telemetry-title {
  color: #475569 !important;
}
html[data-nx-theme="light"] .badge-orange,
html[data-nx-theme="light"] .nx-notif-pill,
html[data-nx-theme="light"] .nx-account-theme-badge,
html[data-nx-theme="light"] .dte-doc-code-badge,
html[data-nx-theme="light"] .dte-guide-step-number,
html[data-nx-theme="light"] .pro-badge-pill {
  color: #c2410c !important;
}
html[data-nx-theme="light"] .nx-account-identity,
html[data-nx-theme="light"] .nx-account-help,
html[data-nx-theme="light"] .nx-notif-desc {
  color: #475569 !important;
}
html[data-nx-theme="light"] .nx-account-logout {
  background: #fff1f2 !important;
  border-color: #fda4af !important;
  color: #be123c !important;
}
html[data-nx-theme="light"] .card,
html[data-nx-theme="light"] .telemetry-card,
html[data-nx-theme="light"] .nwms-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}

/* Ajustes globales móvil (<= 800px) */
@media (max-width: 800px) {
  .topbar,
  .module-topbar,
  .nwms-topbar,
  .nm-topbar,
  .nap-topbar {
    padding-inline: 8px !important;
    gap: 6px !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  .topbar-left,
  .nm-topbar-left,
  .nwms-brand,
  .brand,
  .nap-brand {
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }
  .topbar-right,
  #nexus-account-menu,
  .nx-topbar-right-cluster {
    height: 44px !important;
  }
  .nx-topbar-right-cluster {
    gap: 6px !important;
    flex: 0 0 auto !important;
  }
  .nx-header-menu-btn,
  #btnMobileMenu.mobile-menu-btn,
  #btnToggleDrawer.nm-drawer-btn,
  .nx-notif-trigger {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    flex: 0 0 44px !important;
  }
  .nx-account-trigger {
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }

  /* Controles interactivos >= 16px para evitar auto-zoom iOS y asegurar legibilidad */
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  html body select,
  html body textarea,
  html body .form-control,
  .agenda-daily-controls #agendaFechaFiltro,
  .nwms-input,
  .nwms-select,
  .nwms-textarea,
  .nap-input,
  .nap-select,
  .phone-input,
  .nxc-textarea,
  .module-search,
  .settings-mobile-select-control {
    font-size: 16px !important;
  }

  /* Áreas táctiles mínimas >= 44x44px en móvil */
  .nx-mobile-subtab-btn,
  .nx-sys-mod-btn,
  .nx-sys-sub-item,
  .nx-account-link,
  .nx-account-logout,
  .nx-link-text-danger,
  .dte-clear-btn,
  .clinic-tab-btn,
  .module-tabs > button,
  .module-tabs > a.button,
  .btn-table-action,
  .btn-slot-agendar,
  .btn-slot-ingreso,
  .btn-slot-fin,
  .nwms-nav-btn,
  .nxc-send-btn,
  .nxc-chip,
  .variable-chip,
  .hub-customize-btn,
  .hub-reset-btn,
  .hub-edit-icon-btn,
  .hub-edit-hide-btn,
  .hub-restore-chip,
  .hub-footnote-btn,
  .hub-widget-chips a.hub-sublink {
    min-height: 44px !important;
  }
  .nxc-chip,
  .variable-chip,
  .hub-widget-chips a.hub-sublink {
    display: inline-flex !important;
    align-items: center !important;
  }
  .modal-close,
  .phone-send-btn,
  .nx-sim-send,
  .nxc-icon-btn,
  .nx-link-help-toggle,
  .nx-link-option-help {
    min-width: 44px !important;
    min-height: 44px !important;
  }
  .nx-ast-chip {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Tablas de datos a formato tarjetas en <= 800px */
  .module-table-wrap {
    display: none !important;
  }
  .module-mobile-list {
    display: grid !important;
    gap: 12px !important;
  }
  #view-catalog[data-catalog-layout="table"] .catalog-desktop-table {
    display: none !important;
  }
  #view-catalog[data-catalog-layout="table"] .catalog-mobile-cards {
    display: grid !important;
  }
  .table-wrap {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  .data-table:not(.agenda-accordion-table) {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
  }
  .data-table:not(.agenda-accordion-table) thead {
    display: none !important;
  }
  .data-table:not(.agenda-accordion-table) tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .data-table:not(.agenda-accordion-table) tbody tr {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.025) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-left: 3px solid #f38020 !important;
    border-radius: 12px !important;
    padding: 12px !important;
  }
  html[data-nx-theme="light"] .data-table:not(.agenda-accordion-table) tbody tr {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    border-left: 3px solid #f38020 !important;
  }
  .data-table:not(.agenda-accordion-table) tbody tr td {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-align: right !important;
    padding: 4px 0 !important;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.16) !important;
  }
  .data-table:not(.agenda-accordion-table) tbody tr td:last-child {
    border-bottom: none !important;
    padding-top: 6px !important;
  }
  .data-table:not(.agenda-accordion-table) tbody tr td[colspan] {
    justify-content: center !important;
    text-align: center !important;
  }
  .data-table:not(.agenda-accordion-table) tbody tr td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    color: #f38020;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    flex-shrink: 0;
  }
  html[data-nx-theme="light"] .data-table:not(.agenda-accordion-table) tbody tr td[data-label]::before {
    color: #c2410c;
  }
}

@media (max-width: 420px) {
  #gridVarsCliente,
  #gridVarsCita {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .module-card,
  .card,
  .telemetry-card {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .topbar-left,
  .module-brand,
  .brand-logo,
  .nwms-home-link,
  .nm-topbar-left,
  .nwms-brand,
  .brand,
  .nx-topbar-right-cluster {
    gap: 4px !important;
  }
  .nx-brand-wordmark {
    font-size: 0.85rem !important;
    gap: 3px !important;
  }
  .nx-brand-platform {
    display: none !important;
  }
  .nx-brand-logo,
  .brand-icon,
  .brand-icon img {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    flex: 0 0 34px !important;
  }
  .nx-account-trigger {
    max-width: 88px !important;
  }
}
