/*
 * Generated from the NEXUS 2.0 Design System CSS modules.
 * Run: python scripts/build_nexus_ui_css_bundle.py
 */

/**
 * NEXUS 2.0 — Design System Tokens Visuales Oficiales
 * Fuente de Verdad: docs/diseno/referencia/nexus_shell_visual_v34_usuario_dropdown.html
 */

/* Declaraciones de Fuentes Locales (Producción) */
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local('Public Sans'), url("../../fonts/public-sans-regular.a0d45ec6cee2.woff2") format('woff2');
}

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Public Sans'), url("../../fonts/public-sans-bold.fe554289d33b.woff2") format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('JetBrains Mono'), url("../../fonts/jetbrains-mono-regular.3c265c5a7406.ttf") format('truetype');
}

:root,
[data-theme="light"] {
  color-scheme: light;
  --font-heading: 'Public Sans', sans-serif;
  --font-ui: 'Public Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

  /* Escala de spacing del Design System */
  --nexus-space-1: 4px;
  --nexus-space-2: 8px;
  --nexus-space-3: 12px;
  --nexus-space-4: 16px;
  --nexus-space-5: 20px;
  --nexus-space-6: 24px;
  --nexus-space-7: 32px;
  --nexus-space-8: 40px;

  /* Identidad de Marca */
  --brand-blue: #4176FC;
  --brand-blue-deep: #293854;
  --brand-blue-interaction: #4176FC;
  --brand-blue-primary: #3566E8;
  --brand-blue-hover: #315ED6;
  --brand-blue-accent: #4176FC;
  --brand-blue-soft: #EAF0FF;
  --neutral-blue: #D8DEE7;
  --neutral-bg: #F1F3F6;
  --neutral-text: #526079;
  --brand-red: #CF1823;

  /* Card system canonical tokens. */
  --nexus-card-bg: var(--surface);
  --nexus-card-border: var(--border-soft);
  --nexus-card-radius: var(--radius-card);
  --nexus-card-shadow: var(--shadow-card);
  --nexus-card-padding: 18px 20px;
  --nexus-card-gap: 16px;
  --nexus-card-metric-height: 124px;
  --nexus-card-icon-size: 44px;
  --nexus-card-divider-height: 52px;
  --nexus-card-value-size: 28px;
  --nexus-card-label-size: 11px;
  --nexus-card-primary: var(--brand-blue-interaction);
  --nexus-card-success: var(--success);
  --nexus-card-warning: var(--warning);
  --nexus-card-danger: var(--danger);
  --nexus-card-info: var(--info);
  --nexus-card-neutral: var(--neutral-text);
  --nexus-card-purple: #7357AA;

  /* Page header canonical: values measured from Catalogo Maestro at 1920px. */
  --nexus-page-header-accent: color-mix(in srgb, var(--brand-red) 46%, transparent);
  --nexus-page-header-accent-width: 3px;
  --nexus-page-header-accent-height: 104px;
  --nexus-page-header-gap: 8px;
  --nexus-page-title-size: clamp(26px, 2vw, 32px);
  --nexus-page-title-weight: 700;
  --nexus-page-title-line-height: 1.12;
  --nexus-page-title-letter-spacing: -0.02em;
  --nexus-page-description-size: 14px;
  --nexus-page-description-weight: 400;
  --nexus-page-description-line-height: 21px;

  /* Lienzos y Superficies */
  --canvas: #EAF1FA;
  --shell: #293854;
  --surface: #FFFFFF;
  --surface-soft: #F3F7FD;
  --surface-subtle: #F7FAFF;
  --surface-elevated: #FFFFFF;
  --surface-input: #FFFFFF;


  /* Texto y Neutros */
  --text: #201F24;
  --muted: #526079;
  --subtle: #7D8798;
  --text-secondary: #526079;
  --link: var(--brand-blue-hover);
  --avatar-foreground: var(--brand-blue-hover);

  /* Bordes y Divisiones */
  --border: #D8DEE7;
  --border-strong: #AEB9CB;
  --border-soft: #E8ECF1;
  --focus: #4176FC;
  --focus-ring: rgba(65, 118, 252, .34);
  --focus-ring-soft: rgba(65, 118, 252, .16);

  /* Estados Semánticos */
  --success: #237A4B;
  --success-bg: #EAF6EF;
  --warning: #8A6412;
  --warning-bg: #FFF5D6;
  --danger: #B42318;
  --danger-bg: #FDECEC;
  --info: #4176FC;
  --info-bg: #EEF3FF;

  /* Dimensiones Estructurales del Shell (Valores Oficiales Unificados) */
  --sidebar-expanded: 216px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;
  --watermark-opacity: 0.052;

  /* Radios de Borde */
  --radius-control: 6px;
  --radius-card: 10px;
  --radius-shell: 24px;

  /* Sombras Reguladas */
  --shadow-shell: 0 24px 70px rgba(28, 39, 56, 0.12);
  --shadow-card: 0 8px 24px rgba(34, 68, 120, 0.075), 0 2px 6px rgba(34, 68, 120, 0.035);
  --shadow-float: 0 20px 50px rgba(17, 24, 39, 0.16);

  /* Tiempos de Movimiento y Easing */
  --motion-fast: 120ms;
  --motion-normal: 180ms;
  --motion-slow: 260ms;

  /* Z-Index Jerárquico */
  --z-base: 1;
  --z-sticky: 30;
  --z-dropdown: 50;
  --z-modal: 100;
  --z-toast: 200;
}

[data-theme="dark"] {
  color-scheme: dark;

  --canvas: #111721;
  --shell: #293854;
  --surface: #1D232D;
  --surface-soft: #181C24;
  --surface-subtle: #252E3B;
  --surface-elevated: #232B37;
  --surface-input: #171E28;
  --nexus-card-bg: var(--surface-elevated);
  --nexus-card-border: var(--border-soft);
  --nexus-card-shadow: var(--shadow-card);
  --nexus-card-primary: #91B7FF;
  --nexus-card-success: #7FE0A6;
  --nexus-card-warning: #FFD27A;
  --nexus-card-danger: #FF9C95;
  --nexus-card-info: #91B7FF;
  --nexus-card-neutral: #B6C0CE;
  --nexus-card-purple: #B9A2ED;

  --text: #F7F8FA;
  --muted: #B6C0CE;
  --subtle: #8591A3;
  --text-secondary: #B6C0CE;
  --link: #A8C7FA;
  --avatar-foreground: var(--text);

  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .16);
  --border-soft: rgba(255, 255, 255, .07);
  --focus: #4176FC;
  --focus-ring: rgba(65, 118, 252, .62);
  --focus-ring-soft: rgba(65, 118, 252, .34);

  --success: #7FE0A6;
  --warning: #FFD27A;
  --danger: #FF9C95;
  --info: #91B7FF;
  --success-bg: rgba(35, 122, 75, .28);
  --warning-bg: rgba(138, 100, 18, .32);
  --danger-bg: rgba(180, 35, 24, .30);
  --info-bg: rgba(65, 118, 252, .22);
  --neutral-bg: #232B37;
  --neutral-text: #B6C0CE;

  /* Estados interactivos de filas: siempre permanecen dentro de la escala Dark. */
  --table-row: #1D232D;
  --table-row-zebra: #171E28;
  --table-row-hover: #232A35;
  --table-row-selected: #293342;
  --table-row-focus: rgba(65, 118, 252, .46);

  --shadow-shell: 0 24px 70px rgba(7, 12, 20, .38);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
  --shadow-float: 0 20px 50px rgba(7, 12, 20, .46);
}

/* Soporte de Preferencia de Movimiento Reducido */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/**
 * NEXUS 2.0 — Design System Shell Styles
 * Layout, Sidebar (216px/76px), Topbar, Watermark (5.2% Opacity), User Dropdown, Logout Modal, Subpage Header
 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--shell);
  color: var(--text);
}

body {
  font-family: var(--font-ui), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(65, 118, 252, 0.25) transparent;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: calc(var(--z-toast) + 1);
  padding: 8px 12px;
  border-radius: var(--radius-control);
  background: white;
  color: var(--brand-blue-deep);
  transform: translateY(-150%);
  transition: transform var(--motion-fast) ease;
}

.skip-link:focus-visible { transform: translateY(0); }

/* Scrollbar Personalizada del Sistema NEXUS 2.0 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(65, 118, 252, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(65, 118, 252, 0.45);
  background-clip: padding-box;
}


/* Fondo degradado azul corporativo suave */
body::before {
  content: "";
  position: fixed;
  inset: -14vh -10vw;
  z-index: -2;
  background:
    radial-gradient(circle at 10% 15%, rgba(65, 118, 252, 0.12), transparent 35%),
    radial-gradient(circle at 92% 82%, rgba(207, 24, 35, 0.1), transparent 28%);
}


/* Marca de Agua (Watermark) Logo NEXUS sutil (Opacidad 5.2% V34) */
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: min(82vw, 1100px);
  aspect-ratio: 1/1;
  right: -18vw;
  bottom: -36vh;
  background: url("../../img/nexus/logo-nexus.8281c66867fa.png") no-repeat bottom right;
  background-size: contain;
  opacity: var(--watermark-opacity, 0.052);
  pointer-events: none;
}

/*/* Estructura Principal Shell Grid (Sidebar 216px / 76px) */
.app-shell {
  --nexus-workspace-background: url("../../img/nexus-ui/backgrounds/app-background-light.8a0f86945ee1.png");
  --nexus-workspace-surface: var(--nexus-workspace-background);
  --nexus-sidebar-background: url("../../img/nexus-ui/backgrounds/sidebar-background-light.6d1f1aa85da8.png");
  display: grid;
  grid-template-columns: var(--sidebar-expanded, 216px) 1fr;
  min-height: 100dvh;
  background-color: var(--shell);
  background-image: var(--nexus-sidebar-background);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  transition: grid-template-columns var(--motion-normal) ease;
}

button, a, input, select, textarea, [tabindex]:not([tabindex="-1"]) {
  -webkit-tap-highlight-color: transparent;
}

:where(button, a, input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.app-shell.collapsed {
  grid-template-columns: var(--sidebar-collapsed, 76px) 1fr;
}

/* Sidebar Azul NEXUS (Ancho derivado 100% de la columna .app-shell) */
.sidebar {
  background-color: var(--shell);
  background-image: var(--nexus-sidebar-background);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-close-btn,
.sidebar-overlay {
  display: none;
}

.sidebar-header {
  padding: 0 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: padding var(--motion-normal) ease, gap var(--motion-normal) ease;
  width: 100%;
  box-sizing: border-box;
}

.nexus-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  transition: gap var(--motion-normal) ease;
}

.nexus-logo-image {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: contain;
  padding: 4px;
  border-radius: 11px;
  background: #FFFFFF;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  transform: none;
  transition: margin var(--motion-normal) ease;
}

.nexus-brand-copy {
  min-width: 0;
  max-width: 140px;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--motion-normal) ease,
              max-width var(--motion-normal) ease,
              transform var(--motion-normal) ease;
  transform: translateX(0);
}

.nexus-brand-name {
  font-family: var(--font-heading);
  font-size: 16px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.nexus-brand-sub {
  margin-top: 4px;
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 500;
  color: #AFC2DA;
}


/* Transición continua del estado Colapsado (.sidebar ocupa el 100% de la columna animada) */
.app-shell.collapsed .sidebar-header {
  padding: 0 18px 20px;
  gap: 0;
}

.app-shell.collapsed .nexus-brand {
  gap: 0;
}

.app-shell.collapsed .nexus-brand-copy {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

.nav-section {
  padding: 16px 11px;
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.nav-label {
  margin-inline: -11px;
  padding: 14px 16px 4px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-shell.collapsed .nav-label {
  height: 30px;
  overflow: hidden;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-shell.collapsed .sidebar,
.app-shell.collapsed .nav-section {
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  height: 39px;
  min-height: 39px;
  width: auto;
  margin-inline: 0;
  box-sizing: border-box;
  color: #9CB0C9;
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  position: relative;
  transition: gap var(--motion-normal) ease,
              color var(--motion-normal) ease,
              background var(--motion-normal) ease;
}

.nav-item:hover {
  color: white;
  background: rgba(70, 125, 220, 0.10);
}

/* Texto de Navegación Animable sin display: none */
.nav-item > span:not(.nav-icon) {
  min-width: 0;
  max-width: 140px;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--motion-normal) ease,
              max-width var(--motion-normal) ease,
              transform var(--motion-normal) ease;
  transform: translateX(0);
}

/* Estado activo: superficie clara del Design System; el tema oscuro conserva el fondo del workspace. */
.nav-item.active,
.nav-item.active::before,
.nav-item.active::after {
  background-color: var(--brand-blue-soft);
  background-image: none;
}

.nav-item.active {
  color: var(--brand-blue-hover);
  font-weight: 600;
  border: 0;
  border-radius: 12px 0 0 12px;
  width: calc(100% + 14px);
  margin-left: -3px;
  margin-right: 0;
  box-sizing: border-box;
  box-shadow: none;
  transition: background var(--motion-normal) ease,
              color var(--motion-normal) ease;
}

.nav-item.active:hover {
  color: var(--brand-blue-hover);
  background-color: color-mix(in srgb, var(--brand-blue-soft) 96%, var(--brand-blue-hover));
  box-shadow: inset 0 0 0 1px var(--brand-blue-hover);
}

/* Transición animable para ítems colapsados (Ancho anclado al 100% - 8px) */
.app-shell.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
  width: auto;
  margin-inline: 0;
}

.app-shell.collapsed .nav-item > span:not(.nav-icon) {
  display: none;
  opacity: 0;
  max-width: 0;
  pointer-events: none;
  transform: translateX(-8px);
}

.app-shell.collapsed .nav-icon {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  margin: 0;
  font-size: 18px;
  width: 40px;
  text-align: center;
}

.app-shell.collapsed .nav-item[data-tooltip]:not(.active)::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: var(--z-dropdown);
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-control);
  background: var(--brand-blue-deep);
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.app-shell.collapsed .nav-item[data-tooltip]:not(.active).tooltip-ready:hover::after,
.app-shell.collapsed .nav-item[data-tooltip]:not(.active).tooltip-ready:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.app-shell.is-collapsing .nav-item[data-tooltip]::after,
.app-shell.is-expanding .nav-item[data-tooltip]::after {
  opacity: 0 !important;
  pointer-events: none;
}

.app-shell.is-expanding .nav-label {
  height: 30px;
  overflow: visible;
  white-space: nowrap;
}

.app-shell.collapsed .nav-item.active {
  padding: 0 8px 0 0;
  width: calc(100% + 14px);
  margin-left: -3px;
  margin-right: 0;
  border-radius: 12px 0 0 12px;
}

.app-shell.is-expanding .nav-item.active {
  border-radius: 12px 0 0 12px;
}


/* Navegación NEXUS de dos niveles: el padre conserva .nav-item.active. */
.nexus-nav-group {
  min-width: 0;
}

.nexus-nav-parent {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nexus-nav-parent.active {
  width: calc(100% + 14px);
}

.nexus-nav-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 10px;
  transition: transform 180ms ease;
}

.nexus-nav-group.is-open .nexus-nav-chevron {
  transform: rotate(90deg);
}

.nexus-subnav {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 180ms ease;
}

.nexus-nav-group.is-open .nexus-subnav {
  grid-template-rows: 1fr;
}

.nexus-subnav-inner {
  min-height: 0;
  overflow: visible;
  margin-left: 16px;
  padding-left: 10px;
}

.nexus-subnav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  margin: 3px 4px 3px 0;
  padding: 5px 8px;
  border-radius: 8px;
  color: #D5E3F7;
  font: 500 12px/1.25 var(--font-ui);
  text-decoration: none;
  position: relative;
}

.nexus-subnav-link::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  left: -12px;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  box-sizing: border-box;
  border: 1px solid rgba(238, 247, 255, 0.78);
  border-radius: 50%;
  background: rgba(202, 226, 255, 0.7);
}

/* Cada hijo dibuja línea desde arriba; el último termina en el centro de su nodo. */
.nexus-subnav-link::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: -9px;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: rgba(211, 232, 255, 0.46);
}

.nexus-subnav-link:last-child::after {
  bottom: 50%;
}

.nexus-subnav-link > i {
  width: 14px;
  flex: 0 0 14px;
  font-size: 12px;
  text-align: center;
}

.nexus-subnav-link:hover,
.nexus-subnav-link:focus-visible {
  color: #FFFFFF;
  background: rgba(188, 216, 255, 0.15);
}

.nexus-subnav-link.is-active {
  color: #FFFFFF;
  background: rgba(188, 216, 255, 0.22);
}

.nexus-subnav-link.is-active::before {
  border-color: #E5F3FF;
  background: #CDE8FF;
  box-shadow: 0 0 0 3px rgba(188, 216, 255, 0.22),
              0 0 9px 2px rgba(188, 216, 255, 0.38);
  animation: nexus-subnav-node-pulse 2.1s ease-in-out infinite;
}

@keyframes nexus-subnav-node-pulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(188, 216, 255, 0.18),
                0 0 7px 1px rgba(188, 216, 255, 0.28);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(188, 216, 255, 0.25),
                0 0 11px 2px rgba(188, 216, 255, 0.43);
  }
}

.app-shell.collapsed .nexus-nav-chevron,
.app-shell.collapsed .nexus-subnav {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .nexus-nav-chevron,
  .nexus-subnav {
    transition-duration: 0.01ms;
  }
  .nexus-subnav-link.is-active::before {
    animation: none;
  }
}

/* Curvas cóncavas de la pestaña activa en la unión con el workspace. */
.nav-item.active::before,
.nav-item.active::after {
  content: "";
  position: absolute;
  right: 0;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.nav-item.active::before {
  top: -12px;
  -webkit-mask-image: radial-gradient(circle at 0 0, transparent 12px, #000 12.5px);
  mask-image: radial-gradient(circle at 0 0, transparent 12px, #000 12.5px);
}

.nav-item.active::after {
  bottom: -12px;
  -webkit-mask-image: radial-gradient(circle at 0 100%, transparent 12px, #000 12.5px);
  mask-image: radial-gradient(circle at 0 100%, transparent 12px, #000 12.5px);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: font-size var(--motion-normal) ease, margin var(--motion-normal) ease;
}

/* Superficie Integrada del Workspace con el Token Único var(--surface-soft) */
.main-shell {
  min-width: 0;
  position: relative;
  z-index: 4;
  padding: 12px 12px 12px 0;
  background: transparent;
}

.workspace-surface {
  min-height: calc(100vh - 24px);
  background-color: var(--canvas);
  background-image: var(--nexus-workspace-surface);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  border-radius: var(--radius-shell);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(221, 227, 234, 0.72);
  border-left: 0;
  box-shadow: var(--shadow-shell);
}

/* Topbar con Token Único var(--surface-soft) */
.topbar {
  min-height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}


.topbar-search {
  position: relative;
  flex: 1;
  max-width: 640px;
}

.topbar-title {
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
}

.topbar-search input {
  width: 100%;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--surface-soft);
  padding: 0 40px 0 36px;
  outline: none;
  font-size: 13px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.topbar-search input:focus {
  border-color: var(--brand-blue-interaction);
  box-shadow: 0 0 0 3px var(--focus-ring-soft);
}

.search-icon { position: absolute; left: 12px; top: 11px; color: var(--muted); font-size: 14px; }
.kbd {
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 11px;
  color: var(--subtle);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 6px;
  background: transparent;
}

/* Perfil y Dropdown de Usuario */
.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

.topbar-action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}

.topbar-action-btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.topbar-action-btn:hover {
  background: var(--surface-soft);
  border-color: #C2D1E0;
}

.topbar-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  background: var(--brand-red, #D32F2F);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  line-height: 1;
}

.profile-trigger {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  cursor: pointer;
  user-select: none;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}

.profile-trigger:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.profile-trigger:hover {
  background: var(--surface-soft);
  border-color: #C2D1E0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--info-bg);
  color: var(--avatar-foreground);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info { text-align: left; }
.profile-name { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.profile-role { display: block; font-size: 10px; color: var(--muted); margin-top: 1px; }
.profile-arrow { font-size: 11px; color: var(--muted); transition: transform var(--motion-fast); }

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 248px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  z-index: var(--z-dropdown);
  display: none;
  padding: 7px 0;
  animation: dropdownFade var(--motion-fast) ease;
}

.user-dropdown.is-open { display: block; }

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

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 13px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 5px;
}

.user-dropdown-header > div { min-width: 0; }
.user-dropdown-name { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown-email { color: var(--muted); font-size: 11px; }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 12px);
  margin: 2px 6px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--motion-fast);
  border-radius: 8px;
}

.user-dropdown-item:hover { background: var(--surface-soft); }
.user-dropdown-item.danger { color: var(--brand-red); }
.user-dropdown-item.danger:hover { background: var(--danger-bg); }

/* Área del Workspace */
.workspace {
  padding: 28px 32px 44px;
  width: 100%;
  background: transparent;
  min-height: calc(100vh - var(--topbar-height) - 16px);
}

.messages-container { margin-bottom: 14px; }
.shell-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-left: 4px solid var(--success);
  font-size: 13px;
}
.shell-message.is-error { border-left-color: var(--brand-red); }
.shell-message-icon { margin-right: 6px; color: var(--success); }
.shell-message.is-error .shell-message-icon { color: var(--brand-red); }
.logout-form { display: inline; }

@media (max-width: 1023px) {
  .app-shell { display: block; min-height: 100dvh; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform var(--motion-normal) ease;
    box-shadow: 16px 0 40px rgba(11, 35, 71, 0.22);
    pointer-events: none;
  }

  .app-shell.drawer-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
  }

  .sidebar-close-btn {
    display: grid;
    place-items: center;
    position: absolute;
    top: 16px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: transparent;
    color: white;
    cursor: pointer;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 0;
    padding: 0;
    background: rgba(11, 35, 71, 0.42);
    cursor: pointer;
  }

  .app-shell.drawer-open .sidebar-overlay { display: block; }
  .main-shell { min-width: 0; padding: 0; }
  .workspace-surface { min-height: 100dvh; border: 0; border-radius: 0; }
  .topbar { padding: 0 16px; }
  .topbar-search { min-width: 0; }
  .workspace { min-height: calc(100dvh - var(--topbar-height)); padding: 20px 18px 32px; }
}

@media (max-width: 600px) {
  .topbar { gap: 8px; }
  .topbar-search { max-width: none; }
  .profile-info, .profile-arrow { display: none; }
  .profile-trigger { padding-right: 4px; }
  .workspace { padding: 18px 14px 28px; }
  .page-header { flex-wrap: wrap; }
}


.nexus-page:not(.is-active) { display: none; }

/* Cabecera de Página y Subpáginas */
.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--brand-blue-interaction);
  margin-bottom: 4px;
}

h1, h2, h3 { margin: 0; font-family: var(--font-heading); font-weight: 700; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 18px; }

.page-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Revisión local: composición calmada sobre el sistema oficial. */
.nexus-page > .panel {
  box-shadow: none;
  border-color: var(--border-soft);
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 52px;
  width: min(400px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  z-index: var(--z-dropdown);
  animation: dropdownFade var(--motion-fast) ease;
}
.notifications-dropdown[hidden] { display: none; }
.notifications-dropdown.is-open { display: block; }
.notifications-dropdown-header,
.notifications-dropdown-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; }
.notifications-dropdown-header { border-bottom: 1px solid var(--border-soft); }
.notifications-dropdown-header strong { color: var(--text); font-size: 13px; }
.notifications-dropdown-header span { color: var(--muted); font-size: 11px; }
.notifications-dropdown-list { max-height: 300px; overflow-y: auto; }
.notification-dropdown-item { display: flex; gap: 8px; min-width: 0; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text); text-decoration: none; transition: background var(--motion-fast); }
.notification-dropdown-item:last-child { border-bottom: 0; }
.notification-dropdown-item:hover,
.notification-dropdown-item:focus-visible { background: var(--surface-soft); }
.notification-dropdown-item.is-unread { background: rgba(65, 118, 252, .055); }
.notification-dropdown-item.is-unread:hover,
.notification-dropdown-item.is-unread:focus-visible { background: rgba(65, 118, 252, .10); }
.notification-dropdown-indicator { flex: 0 0 7px; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: transparent; }
.notification-dropdown-item.is-unread .notification-dropdown-indicator {
  background: color-mix(in srgb, var(--brand-red) 60%, #FFFFFF);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-red) 14%, transparent);
}
.notification-dropdown-copy { display: grid; flex: 1 1 auto; min-width: 0; gap: 2px; }
.notification-dropdown-head { display: flex; align-items: baseline; min-width: 0; gap: 8px; }
.notification-dropdown-copy strong { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.notification-dropdown-head time { flex: 0 0 auto; color: var(--subtle); font-size: 10px; line-height: 1.25; white-space: nowrap; }
.notification-dropdown-meta { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.notification-dropdown-item:not(.is-unread) .notification-dropdown-copy strong { font-weight: 500; }
.notifications-dropdown-empty { padding: 14px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.notifications-dropdown-footer { justify-content: center; border-top: 1px solid var(--border-soft); color: var(--brand-blue-interaction); font-size: 12px; font-weight: 700; text-decoration: none; }
.notifications-dropdown-footer:hover,
.notifications-dropdown-footer:focus-visible { background: var(--surface-soft); }

.nexus-page > .panel + .panel,
.page-header + .panel {
  margin-top: 20px;
}

.panel-head { padding: 16px 18px; }

.topbar-action-btn:hover,
.profile-trigger:hover {
  background: var(--surface-soft);
  border-color: var(--border-soft);
}

.theme-toggle[aria-pressed="true"] {
  color: var(--brand-blue-interaction);
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(circle at 10% 15%, rgba(65, 118, 252, .055), transparent 35%),
    radial-gradient(circle at 92% 82%, rgba(65, 118, 252, .035), transparent 28%);
}

[data-theme="dark"] .app-shell {
  --nexus-workspace-surface:
    linear-gradient(rgba(7, 24, 48, 0.78), rgba(7, 24, 48, 0.78)),
    var(--nexus-workspace-background);
}

[data-theme="dark"] .workspace-surface {
  border-color: transparent;
  box-shadow: none;
}

[data-theme="dark"] .topbar,
[data-theme="dark"] .profile-trigger,
[data-theme="dark"] .user-dropdown {
  background: color-mix(in srgb, var(--surface-elevated) 88%, transparent);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .topbar {
  border-bottom-color: transparent;
}

[data-theme="dark"] .icon-btn,
[data-theme="dark"] .topbar-action-btn,
[data-theme="dark"] .theme-toggle {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

[data-theme="dark"] .icon-btn:hover,
[data-theme="dark"] .topbar-action-btn:hover,
[data-theme="dark"] .theme-toggle:hover,
[data-theme="dark"] .profile-trigger:hover,
[data-theme="dark"] .user-dropdown-item:hover {
  background: var(--surface-input);
  border-color: var(--border-strong);
  color: var(--text);
}

[data-theme="dark"] .nav-item { color: var(--text-secondary); }
[data-theme="dark"] .nav-item:hover {
  background: rgba(70, 125, 220, 0.10);
  color: #FFFFFF;
}
[data-theme="dark"] .nav-item.active {
  color: #A9C9FF;
  background-color: transparent;
  background-image: var(--nexus-workspace-surface);
  border: 0;
  box-shadow: none;
}
[data-theme="dark"] .nav-item.active::before,
[data-theme="dark"] .nav-item.active::after {
  background-color: transparent;
  background-image: var(--nexus-workspace-surface);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
[data-theme="dark"] .nav-item.active:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
[data-theme="dark"] .nav-item.active .nav-icon { color: inherit; }
[data-theme="dark"] .app-shell.collapsed .nav-item.active {
  color: #A9C9FF;
  border: 0;
  box-shadow: none;
}

[data-theme="dark"] .topbar-badge {
  border-color: var(--surface);
}

[data-theme="dark"] .sidebar-overlay {
  background: rgba(7, 18, 36, .62);
}

.topbar-search,
.topbar-search input,
.topbar-actions,
.profile-trigger,
.theme-toggle {
  min-width: 0;
}

@media (max-width: 1023px) {
  .workspace { padding: 24px 22px 36px; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .workspace { padding: 22px 16px 32px; }
  .notifications-dropdown { right: -6px; width: min(400px, calc(100vw - 20px)); }
}

/* User menu: a compact identity panel with clear action hierarchy. */
.user-dropdown {
  width: 292px;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(17, 35, 64, .14), 0 3px 10px rgba(17, 35, 64, .08);
}
.user-dropdown-header {
  gap: 12px;
  margin: 0 0 7px;
  padding: 10px 10px 14px;
}
.user-dropdown-header > .avatar {
  width: 42px;
  height: 42px;
  border: 3px solid var(--surface-soft);
  box-shadow: 0 0 0 1px var(--border);
  font-size: 15px;
}
.user-dropdown-name { font-size: 14px; line-height: 1.25; }
.user-dropdown-email { margin-top: 4px; font-size: 11px; line-height: 1.35; }
.user-dropdown-item {
  min-height: 44px;
  width: 100%;
  margin: 3px 0;
  padding: 7px 10px;
  gap: 11px;
  border-radius: 9px;
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.user-dropdown-item > i {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--brand-blue-interaction);
  font-size: 12px;
}
.user-dropdown-item:hover { transform: translateX(1px); }
.user-dropdown-item.danger {
  margin-top: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0 0 9px 9px;
}
.user-dropdown-item.danger > i {
  background: var(--danger-bg);
  color: var(--brand-red);
}
.user-dropdown-item.danger:hover { transform: translateX(1px); }

[data-theme="dark"] .user-dropdown {
  box-shadow: 0 16px 34px rgba(0, 0, 0, .34), 0 3px 10px rgba(0, 0, 0, .2);
}
[data-theme="dark"] .user-dropdown-header > .avatar {
  border-color: var(--surface-input);
  box-shadow: 0 0 0 1px var(--border-strong);
}
[data-theme="dark"] .user-dropdown-item > i {
  background: var(--surface-input);
}

/**
 * NEXUS 2.0 — Design System Component Styles
 * Buttons, Cards, KPIs, Tables (1st col Left, rest Centered), Forms, Tabs, Badges, Loaders, Toasts
 */

button,
input,
select,
textarea { font-family: inherit; }

/* Botones */
.btn {
  min-height: 36px;
  border-radius: var(--radius-control);
  padding: 0 14px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}

.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--brand-blue-primary); color: white; }
.btn-primary:hover { background: var(--brand-blue-hover); }
.btn-secondary { background: white; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-soft); }
.btn-danger { background: white; border-color: #E6B6BA; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-logout { background: var(--brand-red); color: white; }
.btn-logout:hover { background: #B0141E; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--text); }
.btn.is-loading { opacity: 0.75; pointer-events: none; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.icon-btn:hover { background: var(--surface-soft); }

.icon-btn:focus-visible,
.btn:focus-visible,
.nexus-tab:focus-visible,
.user-dropdown-item:focus-visible,
.nexus-toast-close:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Grid System y Paneles */
.grid { display: grid; gap: 14px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.two-col { grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.8fr); }

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: none;
  min-width: 0;
}
.panel.flat { box-shadow: none; }

.panel-head {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
}
.panel-title { font-family: var(--font-heading); font-size: 16px; font-weight: 600; }
.panel-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-body { padding: 16px; }

/* KPIs */
.kpi {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* Regla global ADN Visual NEXUS 2.0: Las tarjetas KPI y de resumen no utilizan franjas laterales decorativas */
.kpi::after {
  content: none;
  display: none;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 24px;
  line-height: 1.1;
  margin-top: 7px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-meta { font-size: 11px; color: var(--subtle); margin-top: 4px; }

/* Tablas Operativas Oficiales: 1ª columna izquierda, todas las demás centradas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 800px; }

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

td {
  font-size: 13px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

/* Alineación Oficial Determinista */
th:first-child, td:first-child { text-align: left; }
th:not(:first-child), td:not(:first-child) { text-align: center; }

tbody tr:hover { background: #FAFCFF; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .tabs-row { align-items: stretch; flex-direction: column; }
  .tabs { overflow-x: auto; max-width: 100%; }
}

/* Home operativo: bloques de contenido, no una cuadrícula de KPIs genérica. */
.home-dashboard { display: grid; gap: 30px; max-width: 1320px; margin: 0 auto; }
.home-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 0 0 18px 16px; border-left: 2px solid var(--brand-blue-interaction); border-bottom: 1px solid var(--border-soft); }
.home-header h1 { margin: 4px 0 0; text-wrap: balance; }
.home-lead { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.home-context-badge { display: grid; gap: 3px; min-width: 150px; padding: 8px 0 8px 14px; border-left: 1px solid var(--border); color: var(--text); font-size: 13px; }
.home-context-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.home-actions { margin: 0; border: 0; background: transparent; }
.home-actions .nexus-panel-header { padding: 0 0 12px; border-bottom: 1px solid var(--border); }
.home-action-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 18px; padding: 0; }
.home-action { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 14px 0; border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; color: var(--text); text-decoration: none; transition: color var(--motion-fast), background var(--motion-fast); }
.home-action:first-child { border-color: var(--border-soft); background: transparent; box-shadow: none; }
.home-action:hover { border-color: var(--border-soft); background: transparent; color: var(--brand-blue-interaction); transform: none; }
.home-action:active { transform: translateY(0); }
.home-action-icon, .activity-icon, .document-icon { display: grid; flex: 0 0 30px; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-soft); color: var(--brand-blue-interaction); }
.home-action-copy, .activity-copy, .document-copy { display: grid; min-width: 0; gap: 2px; }
.home-action-label, .activity-summary, .document-title { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.home-action-description, .activity-meta, .document-meta { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.home-action-arrow { margin-left: auto; color: var(--subtle); font-size: 11px; }
.home-main-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, .72fr); gap: 34px; align-items: start; }
.home-panel { min-width: 0; }
.home-panel.nexus-panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.home-panel .nexus-panel-header { padding: 0 0 12px; border-bottom: 1px solid var(--border); }
.home-panel-link { color: var(--brand-blue-interaction); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.home-panel-link:hover { text-decoration: underline; }
.activity-list, .document-list { margin: 0; padding: 0; list-style: none; }
.activity-item, .document-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.activity-item:last-child, .document-item:last-child { border-bottom: 0; }
.activity-item:hover { background: rgba(234, 242, 251, 0.48); }
.activity-icon { background: var(--info-bg); }
.activity-link { display: grid; flex: 0 0 24px; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.activity-link:hover { background: var(--surface-soft); color: var(--brand-blue-interaction); }
.document-icon { background: transparent; color: var(--muted); }
.document-title { text-decoration: none; }
.document-title:hover { color: var(--brand-blue-interaction); text-decoration: underline; }
.home-empty { display: grid; justify-items: center; gap: 6px; padding: 24px 20px 26px; color: var(--muted); text-align: center; }
.home-documents .home-empty { margin: 12px 0 16px; padding: 20px 8px; border: 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); border-radius: 0; background: transparent; }
.home-empty strong { color: var(--text); font-size: 13px; }
.home-empty span { max-width: 42ch; font-size: 12px; line-height: 1.5; }
.home-empty-icon { margin-bottom: 3px; color: var(--subtle); font-size: 24px; }
.home-empty-action { margin-top: 8px; }
.home-summary { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; }
.home-summary .nexus-panel-header { padding-left: 0; padding-right: 0; }
.home-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0 16px 14px; }
.home-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border-soft); }
.home-metric span { color: var(--muted); font-size: 11px; }
.home-metric strong { color: var(--brand-blue-deep); font-size: 24px; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) { .home-main-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .home-dashboard { gap: 24px; }
  .home-header { align-items: flex-start; flex-direction: column; gap: 12px; padding-left: 10px; }
  .home-context-badge { min-width: 0; width: 100%; }
  .home-action-list { grid-template-columns: minmax(0, 1fr); }
  .home-metrics { grid-template-columns: minmax(0, 1fr); }
}


/* Tablas: la estructura se conserva, pero la superficie deja respirar el contenido. */
.table-wrap table { border-top: 1px solid var(--border-soft); }
.nexus-page > .panel .panel-head + .panel-body { padding-top: 0; }
.nexus-page > .panel td[colspan] { padding: 20px 16px !important; }
.nexus-page > .panel th { padding-top: 9px; padding-bottom: 9px; }
.nexus-page > .panel td { padding-top: 12px; padding-bottom: 12px; }

/* Iteración estructural local: jerarquía transversal para revisión visual. */
.workspace {
  padding: 30px 38px 52px;
}

.nexus-page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.page-header {
  position: relative;
  padding: 0 0 22px 18px;
  margin-bottom: 28px !important;
  border-bottom: 1px solid var(--border);
}

.page-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 22px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand-blue-interaction);
}

.page-header h1,
.home-header h1 {
  font-size: clamp(26px, 2vw, 32px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.page-header > div:last-child {
  padding-top: 4px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--brand-blue-interaction);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.page-sub,
.page-header p[style*="font-size"] {
  max-width: 72ch;
  line-height: 1.5 !important;
}

.nexus-page > .panel {
  border-color: var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.nexus-page > .panel[style*="margin-bottom"] {
  margin-bottom: 22px !important;
}

.panel-head {
  min-height: 62px;
  padding: 15px 18px;
}

.panel-title {
  color: var(--brand-blue-deep);
  font-size: 15px;
  letter-spacing: -0.01em;
}

.panel-sub {
  line-height: 1.4;
}

/* Listados: franja de filtros y tabla como dos zonas distintas. */
.nexus-page > .panel:has(.table-wrap) {
  overflow: hidden;
}

.nexus-page > .panel:has(.table-wrap) .panel-head {
  border-bottom: 0;
  background: var(--surface);
}

.nexus-page > .panel:has(.table-wrap) .table-wrap {
  border-top: 1px solid var(--border-soft);
}

table {
  background: var(--surface);
}

th {
  padding: 11px 14px;
  background: #F1F5F9;
  color: var(--brand-blue-deep);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.075em;
}

td {
  min-height: 50px;
  padding: 13px 14px;
  color: var(--text);
  line-height: 1.35;
}

tbody tr {
  transition: background var(--motion-fast) ease;
}

tbody tr:hover {
  background: #F5F9FF;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.nexus-page > .panel td[colspan] {
  padding: 26px 20px !important;
  background: #FBFCFE;
  color: var(--muted);
  font-size: 13px;
}

/* Detalles: columna de contexto + contenido principal, con ritmo estable. */
.nexus-page > div[style*="grid-template-columns"] {
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.7fr) !important;
  gap: 24px !important;
  align-items: start;
}

.nexus-page > div[style*="grid-template-columns"] > .panel {
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.nexus-page > div[style*="grid-template-columns"] > .panel:first-child .panel-head {
  border-top: 3px solid var(--brand-blue-interaction);
}

.nexus-page > div[style*="grid-template-columns"] > .panel .panel-body {
  line-height: 1.5;
}

.nexus-page > div[style*="grid-template-columns"] table {
  min-width: 0;
}

/* Home: centro de trabajo con dos zonas principales y apoyo inferior. */
.home-dashboard {
  max-width: 1480px;
  gap: 28px;
}

.home-header {
  padding-bottom: 22px;
}

.home-actions {
  padding: 0 2px;
}

.home-actions .nexus-panel-header {
  min-height: 0;
}

.home-action-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0 20px;
  border-bottom: 1px solid var(--border);
}

.home-action {
  min-height: 62px;
  padding: 13px 0;
}

.home-action-icon {
  background: var(--info-bg);
}

.home-main-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 28px;
}

.home-panel.nexus-panel {
  padding: 0 18px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.home-panel .nexus-panel-header {
  min-height: 66px;
  padding: 16px 0 13px;
}

.activity-item,
.document-item {
  min-height: 58px;
  padding: 13px 0;
}

.activity-item:hover {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
}

.home-summary {
  padding: 0 18px 4px;
}

.home-metrics {
  padding: 0 0 14px;
}

.home-metric {
  padding: 14px 12px;
  border-top-color: var(--border);
}

.home-metric strong {
  font-family: var(--font-heading);
  font-size: 28px;
}

@media (max-width: 1100px) {
  .workspace { padding-left: 28px; padding-right: 28px; }
  .home-action-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nexus-page > div[style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .home-action-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .workspace { padding: 22px 16px 34px; }
  .page-header { padding-left: 12px; padding-bottom: 18px; margin-bottom: 22px !important; }
  .page-header::before { bottom: 18px; width: 2px; }
  .page-header h1,
  .home-header h1 { font-size: 26px; }
  .page-header > div:last-child { padding-top: 0; }
  .home-action-list { grid-template-columns: minmax(0, 1fr); }
  .home-panel.nexus-panel,
  .home-summary { padding-left: 14px; padding-right: 14px; }
}

/* Segunda iteración local: superficies y proporciones de trabajo. */
.toolbar-panel {
  border-color: #D7E0EA !important;
  background: #F7F9FC !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

.toolbar-panel .panel-body {
  padding: 14px 16px !important;
}

.document-toolbar form {
  display: grid !important;
  grid-template-columns: minmax(240px, 1.45fr) minmax(160px, 0.9fr) minmax(160px, 0.9fr) auto auto;
  gap: 10px !important;
}

.document-toolbar .input,
.document-toolbar .select,
.audit-toolbar .form-control {
  max-width: none !important;
  width: 100%;
}

.audit-toolbar form {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px !important;
}

.audit-toolbar form > div:last-child {
  align-self: end;
}

.nexus-page > .panel:has(.table-wrap) .panel-body {
  padding: 0 14px 14px !important;
}

.nexus-page > .panel:has(.table-wrap) .table-wrap {
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  scrollbar-color: #A9BCD2 #F1F5F9;
}

.nexus-page > .panel:has(.table-wrap) th {
  padding: 12px 14px;
  background: #EEF3F8;
}

.nexus-page > .panel:has(.table-wrap) td {
  padding: 14px;
}

.nexus-page > .panel:has(.table-wrap) tbody tr + tr td {
  border-top: 1px solid #E8EEF4;
}

.nexus-page > .panel:has(.table-wrap) td:last-child,
.nexus-page > .panel:has(.table-wrap) th:last-child {
  padding-right: 16px;
  white-space: nowrap;
}

.nexus-page > .panel:has(.table-wrap) td:last-child .btn {
  min-width: 34px;
}

/* Detalle documental: dos zonas superiores con peso real y adjuntos como módulo principal. */
.nexus-page > div.document-detail-layout[style*="grid-template-columns"] {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr) !important;
  gap: 24px !important;
}

.document-detail-summary,
.document-detail-admin {
  min-height: 236px;
}

.document-detail-admin form {
  width: 100%;
}

.document-attachments {
  border-top: 3px solid var(--brand-blue-interaction) !important;
}

/* Detalle de tercero: el maestro ocupa el lienzo y los complementos forman una segunda zona. */
.nexus-page > div.tercero-detail-layout[style*="grid-template-columns"] {
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr) !important;
  gap: 24px !important;
}

.tercero-detail-layout > .nexus-panel {
  min-width: 0;
}

.tercero-master-panel,
.tercero-commercial-panel {
  min-height: 300px;
}

.tercero-detail-layout:not(:has(.tercero-commercial-panel)) .tercero-master-panel {
  grid-column: 1 / -1;
}

.tercero-detail-layout table {
  min-width: 0;
}

.tercero-detail-layout table td:not(:first-child) {
  text-align: left;
}

.tercero-detail-layout table td {
  padding: 11px 0;
}

.tercero-nexus-panel {
  border-top: 3px solid var(--brand-blue-interaction) !important;
}

.tercero-nexus-panel .nexus-panel-body > div:first-child {
  gap: 20px !important;
}

/* Auditoría: más espacio para el payload sin perder una columna de contexto legible. */
.nexus-page > div.audit-detail-layout[style*="grid-template-columns"] {
  grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr) !important;
  gap: 24px !important;
}

.audit-metadata-panel,
.audit-payload-panel {
  min-height: 272px;
}

.audit-metadata-panel .nexus-panel-header,
.audit-payload-panel .nexus-panel-header {
  border-top: 3px solid var(--brand-blue-interaction);
}

.audit-payload-panel pre {
  min-height: 154px;
  margin: 0;
}

/* Home: acciones como índice de trabajo y documentos como panel secundario con presencia. */
.home-actions.panel {
  padding: 0 18px 4px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand-blue-interaction);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.home-actions .nexus-panel-header {
  padding-top: 14px;
}

.home-documents {
  border-top: 3px solid var(--brand-blue-interaction) !important;
  background: #F9FBFD !important;
}

.home-documents .document-item {
  padding: 15px 2px;
}

@media (max-width: 1100px) {
  .document-toolbar form,
  .audit-toolbar form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document-toolbar form > .btn,
  .document-toolbar form > a,
  .audit-toolbar form > div:last-child {
    justify-self: start;
  }
}

@media (max-width: 900px) {
  .home-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .nexus-page > div.document-detail-layout[style*="grid-template-columns"],
  .nexus-page > div.tercero-detail-layout[style*="grid-template-columns"],
  .nexus-page > div.audit-detail-layout[style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .document-detail-summary,
  .document-detail-admin,
  .tercero-master-panel,
  .tercero-commercial-panel,
  .audit-metadata-panel,
  .audit-payload-panel {
    min-height: 0;
  }
  .tercero-nexus-panel {
    grid-column: auto !important;
  }
}

@media (max-width: 600px) {
  .toolbar-panel .panel-body,
  .nexus-page > .panel:has(.table-wrap) .panel-body {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .document-toolbar form,
  .audit-toolbar form {
    grid-template-columns: minmax(0, 1fr);
  }
  .document-toolbar form > .btn,
  .document-toolbar form > a,
  .audit-toolbar form > div:last-child {
    width: 100%;
  }
  .document-toolbar form > .btn,
  .document-toolbar form > a {
    justify-content: center;
  }
  .tercero-detail-layout table td {
    padding: 10px 0;
  }
}

/* Formularios */
.input, .select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: white;
  color: var(--text);
  padding: 0 10px;
  outline: none;
  font-size: 13px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.input:focus, .select:focus {
  border-color: var(--brand-blue-interaction);
  box-shadow: 0 0 0 3px var(--focus-ring-soft);
}

/* Badges */
.badge {
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-info { color: #174B8F; background: var(--info-bg); }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-neutral { color: #475467; background: #F2F4F7; }

/* Progress Bar */
.progress { height: 7px; border-radius: 999px; background: #EAF0F5; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand-blue-interaction); }

/* Estados de Carga y Feedback */
.loader {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #D9E3EE;
  border-top-color: var(--brand-blue-interaction);
  border-right-color: var(--brand-red);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #EDF1F5 25%, #F8FAFC 37%, #EDF1F5 63%);
  background-size: 400% 100%;
  animation: shimmer 1.25s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 36px 18px;
  text-align: center;
}
.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  background: var(--info-bg);
  color: var(--brand-blue-interaction);
  font-size: 20px;
}
.empty-title { font-family: var(--font-heading); font-weight: 600; }
.empty-text { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Sistema canónico de Toasts */
.nexus-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.nexus-toast {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  pointer-events: auto;
  animation: nexus-toast-in var(--motion-normal) ease;
  transition: opacity var(--motion-fast), transform var(--motion-fast);
}

@keyframes nexus-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.nexus-toast.is-leaving { opacity: 0; transform: translateX(20px); }
.nexus-toast-success { border-left: 4px solid var(--success); }
.nexus-toast-info { border-left: 4px solid var(--brand-blue-interaction); }
.nexus-toast-warning { border-left: 4px solid var(--warning); }
.nexus-toast-danger { border-left: 4px solid var(--brand-red); }

.nexus-toast-icon { flex: 0 0 auto; padding-top: 1px; font-size: 16px; }
.nexus-toast-success .nexus-toast-icon { color: var(--success); }
.nexus-toast-info .nexus-toast-icon { color: var(--brand-blue-interaction); }
.nexus-toast-warning .nexus-toast-icon { color: var(--warning); }
.nexus-toast-danger .nexus-toast-icon { color: var(--brand-red); }
.nexus-toast-content { min-width: 0; }
.nexus-toast-title { font-weight: 600; font-size: 13px; }
.nexus-toast-message { margin-top: 2px; color: var(--muted); font-size: 12px; }
.nexus-toast-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.nexus-toast-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  padding: 2px;
}
.nexus-toast-close:hover { color: var(--text); }

/* Mensajes Django: usan la superficie canónica de feedback, pero permanecen
   inline dentro del workspace y conservan su ciclo de vida server-side. */
.messages-container .shell-message {
  min-width: 0;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  animation: none;
  transition: none;
}

@media (max-width: 600px) {
  .nexus-toast-container { top: 12px; right: 12px; left: 12px; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nexus-toast { animation: none; transition: none; }
  .nexus-btn.is-loading::after,
  .nexus-btn-primary.is-loading::after,
  .nexus-btn-secondary.is-loading::after,
  .nexus-btn-danger.is-loading::after,
  .nexus-btn-ghost.is-loading::after,
  .nexus-btn-icon.is-loading::after,
  .nexus-btn[aria-busy="true"]::after { animation: none; }
}

/* Theme contract: canonical surfaces inherit the active shell theme. */
.nexus-input,
.nexus-select,
.nexus-textarea,
.nexus-file-input,
.nexus-form .input,
.nexus-form .select,
.nexus-form textarea,
.nexus-form input[type="text"],
.nexus-form input[type="email"],
.nexus-form input[type="number"],
.nexus-form input[type="date"],
.nexus-form input[type="password"],
.nexus-form input[type="file"] {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
}

.nexus-toolbar,
.nexus-toolbar form,
.nexus-toolbar-search,
.nexus-toolbar input,
.nexus-toolbar select,
.nexus-toolbar .input,
.nexus-toolbar .select,
.nexus-toolbar .form-control {
  min-width: 0;
  box-sizing: border-box;
}

.nexus-toolbar input,
.nexus-toolbar select,
.nexus-toolbar .input,
.nexus-toolbar .select,
.nexus-toolbar .form-control {
  max-width: 100%;
}

.nexus-badge-neutral {
  color: var(--neutral-text);
  background: var(--neutral-bg);
}

[data-theme="dark"] .nexus-card,
[data-theme="dark"] .nexus-panel,
[data-theme="dark"] .nexus-panel-compact,
[data-theme="dark"] .nexus-form-surface,
[data-theme="dark"] .nexus-table-module,
[data-theme="dark"] .nexus-toolbar,
[data-theme="dark"] .nexus-tabs,
[data-theme="dark"] .tabs,
[data-theme="dark"] .tabs-bar,
[data-theme="dark"] .nexus-modal,
[data-theme="dark"] .nexus-toast {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text);
}

[data-theme="dark"] .nexus-tab,
[data-theme="dark"] .tab,
[data-theme="dark"] .tab-btn {
  color: var(--muted) !important;
}
[data-theme="dark"] .nexus-tab:hover,
[data-theme="dark"] .tab:hover,
[data-theme="dark"] .tab-btn:hover {
  background: var(--surface-soft) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .nexus-tab.is-active,
[data-theme="dark"] .nexus-tab.active,
[data-theme="dark"] .tab.is-active,
[data-theme="dark"] .tab.active,
[data-theme="dark"] .tab-btn.is-active,
[data-theme="dark"] .tab-btn.active {
  background: var(--brand-blue-primary) !important;
  color: #ffffff !important;
  border-color: var(--brand-blue-primary) !important;
}

[data-theme="dark"] .nexus-card-header,
[data-theme="dark"] .nexus-panel-header,
[data-theme="dark"] .nexus-card-footer,
[data-theme="dark"] .nexus-panel-footer,
[data-theme="dark"] .nexus-table-toolbar {
  border-color: var(--border-soft) !important;
}

[data-theme="dark"] .nexus-card-title,
[data-theme="dark"] .nexus-panel-title,
[data-theme="dark"] .nexus-form-section-title,
[data-theme="dark"] .nexus-empty-state-title,
[data-theme="dark"] .nexus-table-module-title,
[data-theme="dark"] .nexus-modal-title {
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-input,
[data-theme="dark"] .nexus-select,
[data-theme="dark"] .nexus-textarea,
[data-theme="dark"] .nexus-file-input,
[data-theme="dark"] .nexus-form .input,
[data-theme="dark"] .nexus-form .select,
[data-theme="dark"] .nexus-form textarea,
[data-theme="dark"] .nexus-form input,
[data-theme="dark"] .nexus-form select {
  background: var(--surface-subtle) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-input::placeholder,
[data-theme="dark"] .nexus-textarea::placeholder,
[data-theme="dark"] .nexus-form input::placeholder,
[data-theme="dark"] .nexus-form textarea::placeholder {
  color: var(--subtle);
  opacity: 1;
}

[data-theme="dark"] .nexus-input[readonly],
[data-theme="dark"] .nexus-textarea[readonly],
[data-theme="dark"] .nexus-form input[readonly],
[data-theme="dark"] .nexus-form textarea[readonly] {
  background: var(--surface) !important;
}

[data-theme="dark"] .nexus-input:disabled,
[data-theme="dark"] .nexus-select:disabled,
[data-theme="dark"] .nexus-textarea:disabled,
[data-theme="dark"] .nexus-form input:disabled,
[data-theme="dark"] .nexus-form select:disabled,
[data-theme="dark"] .nexus-form textarea:disabled {
  background: var(--surface-soft) !important;
  color: var(--muted) !important;
}

[data-theme="dark"] .nexus-table-module,
[data-theme="dark"] .nexus-table-wrap,
[data-theme="dark"] .nexus-table {
  background: var(--surface) !important;
}

[data-theme="dark"] .nexus-table thead th {
  background: var(--surface-subtle) !important;
  border-color: var(--border-soft) !important;
  color: var(--muted) !important;
}

[data-theme="dark"] .nexus-table tbody td {
  border-color: var(--border-soft) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-table tbody td:first-child {
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-table tbody tr:nth-child(even) td,
[data-theme="dark"] .nexus-table tbody tr:hover td {
  background: var(--surface-subtle) !important;
}

[data-theme="dark"] .nexus-table tbody tr:hover td {
  box-shadow: inset 0 0 0 9999px rgba(65, 118, 252, .08);
}

[data-theme="dark"] .nexus-btn-secondary,
[data-theme="dark"] .nexus-btn-danger,
[data-theme="dark"] .nexus-btn-icon {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text);
}

[data-theme="dark"] .nexus-btn-secondary:hover,
[data-theme="dark"] .nexus-btn-icon:hover,
[data-theme="dark"] .nexus-btn-ghost:hover {
  background: var(--surface-subtle) !important;
  border-color: var(--border-strong) !important;
  color: var(--text);
}

[data-theme="dark"] .nexus-tab {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--muted);
}

[data-theme="dark"] .nexus-tab:hover {
  background: var(--surface-subtle) !important;
  border-color: var(--border-strong) !important;
  color: var(--text);
}

[data-theme="dark"] .nexus-tab.is-active {
  background: var(--brand-blue-interaction) !important;
  border-color: var(--brand-blue-interaction) !important;
  color: #fff;
}

[data-theme="dark"] .nexus-empty-state {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

[data-theme="dark"] .nexus-modal-backdrop {
  background: rgba(7, 18, 36, .72);
}

[data-theme="dark"] .nexus-pagination,
[data-theme="dark"] .nexus-pagination-link {
  color: var(--muted);
  border-color: var(--border);
}

[data-theme="dark"] .nexus-pagination-link:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

/* ==========================================================================
   Componente de Login — Fachada Distrimayor + Glassmorphism Premium (NEXUS 2.0)
   ========================================================================== */

.login-viewport {
  min-height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  position: relative;
  overflow-x: hidden;
  background-color: #F4F6F8;
  /* Fallback estático extraído del mismo video, sin la curva del login anterior. */
  background-image: url("../../img/nexus/login-fachada-poster.16e3687b3d64.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.login-facade-video {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

@media (max-width: 900px) {
  .login-facade-video { object-position: 58% center; }
}

.login-facade-glass {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(7, 18, 36, 0.14);
}

.login-viewport.login-video-ready .login-facade-glass {
  display: block;
}

/* Contenedor de Posicionamiento TRANSPARENTE para la Zona Derecha (Formulario + Footer) */
.login-auth-zone {
  position: absolute;
  right: 4vw;
  width: min(48vw, 480px);
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  z-index: 10;
  pointer-events: none;
  background: transparent;
  isolation: isolate;
  top: 50%;
  transform: translateY(-50%);
}

.login-auth-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 26px;
  box-shadow: 0 20px 56px rgba(7, 18, 36, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
  backdrop-filter: blur(22px) saturate(1.08);
}

/* Interactivación de Elementos dentro de la Zona Transparente */
.login-form-wrapper,
.login-footer {
  pointer-events: auto;
  z-index: 1;
}

/* Formulario Centrado dentro de la Zona Derecha */
.login-form-wrapper {
  width: 100%;
  max-width: 400px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  position: relative;
}

@keyframes loginBrandReveal {
  from { opacity: 0; transform: translateY(7px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Encabezado de marca centrado */
.login-header {
  text-align: center;
  width: 100%;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-brand-logo {
  width: 186px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  display: block;
  filter: none !important;
  box-shadow: none !important;
  transform-origin: center;
  animation: loginBrandReveal 820ms cubic-bezier(0.2, 0.75, 0.25, 1) 80ms both;
}

@media (prefers-reduced-motion: reduce) {
  .login-facade-video,
  .login-facade-glass { display: none !important; }
  .login-form-wrapper,
  .login-brand-logo { animation: none !important; }
}

/* FORMULARIO */
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.login-form-group {
  margin-bottom: 20px;
  width: 100%;
}

.login-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.85);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-input-icon {
  position: absolute;
  left: 16px;
  color: #64748B;
  font-size: 15px;
  pointer-events: none;
  transition: color var(--motion-fast);
}

.login-input,
.login-submit-btn {
  font-family: inherit;
}

.login-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  font-size: 14px;
  color: #0F172A;
  background-color: rgba(255, 255, 255, 0.95);
  outline: none;
  font-weight: 500;
  box-sizing: border-box;
  box-shadow: 0 4px 14px rgba(7, 18, 36, 0.18);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background-color var(--motion-fast);
}

.login-input:focus {
  background-color: #FFFFFF;
  border-color: var(--brand-blue-interaction);
  box-shadow: 0 0 0 4px var(--focus-ring), 0 4px 16px rgba(7, 18, 36, 0.22);
}

.login-input:focus ~ .login-input-icon,
.login-input-wrap:focus-within .login-input-icon {
  color: var(--brand-blue-interaction);
}

/* Alerta de Error */
.login-alert {
  width: 100%;
  padding: 12px 16px;
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid var(--brand-red, #CF1823);
  border-radius: 8px;
  color: #991B1B;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
}

/* Botón Principal */
.login-submit-btn {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, var(--brand-blue-primary) 0%, var(--brand-blue-deep) 100%);
  color: #FFFFFF;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(17, 65, 128, 0.28);
  transition: background var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
  margin-top: 10px;
}

.login-submit-btn:hover {
  background: linear-gradient(135deg, var(--brand-blue-hover) 0%, var(--brand-blue-deep) 100%);
  box-shadow: 0 6px 22px rgba(17, 65, 128, 0.38);
  transform: translateY(-1px);
}

.login-submit-btn:hover i {
  transform: translateX(4px);
}

.login-submit-btn i {
  transition: transform var(--motion-fast);
}

.login-submit-btn:active {
  transform: translateY(0) scale(0.985);
}

/* Pie de página del área de autenticación, debajo del formulario. */
.login-footer {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
  padding-top: 15px;
  width: 100%;
  max-width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  white-space: normal;
  z-index: 10;
}

.login-footer * {
  pointer-events: auto;
}

.login-endorsement-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
  filter: none !important;
  box-shadow: none !important;
  opacity: 0.95;
  transition: opacity var(--motion-fast);
}

.login-endorsement-logo:hover {
  opacity: 1;
}

.login-copyright {
  font-size: 12px;
  color: #1E293B;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   RESPONSIVE (MÓVIL Y TABLET)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .login-viewport {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .login-auth-zone {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    width: calc(100% - 32px);
    max-width: 480px;
    min-height: 0;
    height: auto;
    margin: 24px auto;
    padding: 22px;
    background: transparent;
  }

  .login-auth-zone::before {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.68);
  }

  .login-footer {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    margin-top: 30px;
    width: max-content;
    max-width: 100%;
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .login-viewport {
    width: 100%;
    min-height: 100svh;
    height: auto;
    padding: 16px 0;
    box-sizing: border-box;
    background-position: 20% center;
    background-attachment: scroll;
  }

  .login-facade-video { object-position: 20% center; }
  .login-facade-glass { background: rgba(7, 18, 36, 0.1); }

  .login-auth-zone {
    padding: 20px;
  }

  .login-auth-zone {
    width: min(90%, 340px);
    max-width: 340px;
    margin: 16px auto;
  }

  .login-auth-zone::before {
    background: rgba(255, 255, 255, 0.52);
    border-radius: 24px;
    box-shadow: 0 16px 36px rgba(7, 18, 36, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.58);
    -webkit-backdrop-filter: blur(18px) saturate(1.06);
    backdrop-filter: blur(18px) saturate(1.06);
  }

  .login-brand-logo {
    width: 132px;
  }

  .login-header {
    margin-bottom: 16px;
  }

  .login-submit-btn {
    height: 48px;
    font-size: 14px;
  }

  .login-footer {
    gap: 8px;
    flex-direction: column;
    flex-wrap: nowrap;
    margin-top: 22px;
    padding-top: 12px;
    text-align: center;
  }

  .login-endorsement-logo { height: 20px; }

  .login-copyright {
    font-size: 11.5px;
    white-space: normal;
    text-align: center;
  }
}

/* Piloto ADN tipográfico: Public Sans sólo en Home, Usuarios y Documento. */
@font-face {
  font-family: "Public Sans Pilot";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../fonts/public-sans-regular.a0d45ec6cee2.woff2") format("woff2");
}

@font-face {
  font-family: "Public Sans Pilot";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../fonts/public-sans-bold.fe554289d33b.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono Pilot";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../fonts/jetbrains-mono-regular.3c265c5a7406.ttf") format("truetype");
}

.nexus-page:not(.profile-page),
.nexus-page:not(.profile-page) button,
.nexus-page:not(.profile-page) input,
.nexus-page:not(.profile-page) select,
.nexus-page:not(.profile-page) textarea {
  font-family: "Public Sans Pilot", sans-serif;
}

.nexus-page:not(.profile-page) h1,
.nexus-page:not(.profile-page) h2,
.nexus-page:not(.profile-page) h3,
.nexus-page:not(.profile-page) .panel-title,
.nexus-page:not(.profile-page) .home-action-label,
.nexus-page:not(.profile-page) .activity-summary,
.nexus-page:not(.profile-page) .document-title {
  font-family: "Public Sans Pilot", sans-serif;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.nexus-page:not(.profile-page) h1,
.nexus-page:not(.profile-page) .home-header h1 {
  font-size: clamp(27px, 2.15vw, 34px);
  line-height: 1.08;
}

.nexus-page:not(.profile-page) .panel-title {
  font-size: 15px;
  line-height: 1.2;
}

.nexus-page:not(.profile-page) .page-sub,
.nexus-page:not(.profile-page) .home-lead,
.nexus-page:not(.profile-page) .panel-sub {
  line-height: 1.45;
}

.nexus-page:not(.profile-page) .eyebrow,
.nexus-page:not(.profile-page) th,
.nexus-page:not(.profile-page) .home-context-label {
  font-family: "Public Sans Pilot", sans-serif;
  font-weight: 700;
  letter-spacing: 0.085em;
}

.nexus-page:not(.profile-page) td,
.nexus-page:not(.profile-page) .btn,
.nexus-page:not(.profile-page) .input,
.nexus-page:not(.profile-page) .select,
.nexus-page:not(.profile-page) .home-action-description,
.nexus-page:not(.profile-page) .activity-meta,
.nexus-page:not(.profile-page) .document-meta {
  font-size: 13px;
  line-height: 1.4;
}

.nexus-page:not(.profile-page) .document-detail-layout {
  gap: 22px !important;
}

.nexus-page:not(.profile-page) .document-detail-admin {
  min-height: 214px;
}

.nexus-page:not(.profile-page) .document-attachments {
  margin-top: 4px;
}

.nexus-page:not(.profile-page) .table-wrap code,
.nexus-page:not(.profile-page) .table-wrap td:first-child code,
.nexus-page:not(.profile-page) [style*="font-family: monospace"],
.nexus-page:not(.profile-page) pre {
  font-family: "JetBrains Mono Pilot", monospace !important;
}

@media (max-width: 600px) {
  .nexus-page:not(.profile-page) h1,
  .nexus-page:not(.profile-page) .home-header h1 {
    font-size: 27px;
    line-height: 1.08;
  }
}

/* Rediseño estructural local: sólo Home, Usuarios y Detalle Documento. */
.nexus-page.is-active:not(.profile-page) {
  --nexus-surface: #ffffff;
  --nexus-surface-muted: #f7f9fc;
  --nexus-border: #e4e9f0;
  --nexus-shadow-sm: 0 5px 18px rgba(19, 42, 76, 0.035);
  --nexus-shadow-md: 0 10px 26px rgba(19, 42, 76, 0.055);
  display: grid;
  gap: var(--nexus-space-7);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  color: #18253a;
}

@media (min-width: 1024px) {
  .workspace:has(.nexus-page:not(.profile-page)) { padding-right: 16px; padding-left: 16px; }
}

.nexus-section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #61708a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.nexus-page:not(.profile-page) h1 { margin-top: 6px; color: var(--text); font-size: clamp(30px, 3vw, 42px); letter-spacing: -.04em; }
.nexus-page:not(.profile-page) .home-lead { max-width: 62ch; margin: 8px 0 0; color: #64748b; font-size: 14px; line-height: 1.6; }

.nexus-page:not(.profile-page) .nexus-context-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  padding: 14px 16px;
  border: 1px solid var(--nexus-border);
  border-radius: 14px;
  background: var(--nexus-surface);
  box-shadow: var(--nexus-shadow-sm);
}
.nexus-page:not(.profile-page) .nexus-context-card > span:last-child { display: grid; gap: 3px; }
.nexus-page:not(.profile-page) .nexus-context-card strong { color: #17233a; font-size: 13px; }
.nexus-page:not(.profile-page) .nexus-context-label { color: #748197; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.nexus-page:not(.profile-page) .nexus-context-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #eaf2fb;
  color: #2563a9;
  font-size: 17px;
}

.nexus-page:not(.profile-page) .nexus-panel {
  overflow: hidden;
  border: 1px solid var(--nexus-border);
  border-radius: 16px;
  background: var(--nexus-surface);
  box-shadow: var(--nexus-shadow-sm);
}
.nexus-page:not(.profile-page) .nexus-panel,
.nexus-page:not(.profile-page) .home-panel.nexus-panel,
.nexus-page:not(.profile-page) .home-documents,
.nexus-page:not(.profile-page) .user-directory,
.nexus-page:not(.profile-page) .document-attachments { border-top: 1px solid var(--nexus-border) !important; }
.nexus-page:not(.profile-page) .nexus-panel:hover { box-shadow: var(--nexus-shadow-md); }
.nexus-page:not(.profile-page) .nexus-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border: 0; }
.nexus-page:not(.profile-page) .nexus-panel-body { padding: 0 24px 24px; }
.nexus-page:not(.profile-page) .nexus-panel-title { margin-top: 3px; color: var(--text); font-size: 17px; }
.nexus-page:not(.profile-page) .nexus-panel-description { margin-top: 5px; color: var(--text-secondary); font-size: 12px; }
.nexus-page:not(.profile-page) .home-panel-link { display: inline-flex; align-items: center; gap: 6px; color: #2360aa; font-size: 12px; font-weight: 700; text-decoration: none; }
.nexus-page:not(.profile-page) .home-panel-link:hover { color: #174b8f; text-decoration: none; }

.nexus-page:not(.profile-page) .nexus-home-workgrid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(280px, .9fr); gap: var(--nexus-space-7); align-items: start; }
.nexus-page:not(.profile-page) .home-panel.nexus-panel { border: 1px solid var(--nexus-border); border-radius: 16px; background: var(--nexus-surface); box-shadow: var(--nexus-shadow-sm); }
.nexus-page:not(.profile-page) .activity-list,
.nexus-page:not(.profile-page) .document-list { margin: 0; padding: 0; list-style: none; }
.nexus-page:not(.profile-page) .activity-item,
.nexus-page:not(.profile-page) .document-item { gap: 14px; padding: 15px 0; border-bottom: 1px solid #edf0f4; }
.nexus-page:not(.profile-page) .activity-item:last-child,
.nexus-page:not(.profile-page) .document-item:last-child { border-bottom: 0; }
.nexus-page:not(.profile-page) .activity-item:hover { background: #fafcff; }
.nexus-page:not(.profile-page) .activity-icon,
.nexus-page:not(.profile-page) .document-icon,
.nexus-page:not(.profile-page) .home-action-icon { flex-basis: 34px; width: 34px; height: 34px; border-radius: 10px; }
.nexus-page:not(.profile-page) .activity-icon { background: #eef5ff; color: #2563a9; }
.nexus-page:not(.profile-page) .document-icon { background: #f4f1ff; color: #7059b6; }
.nexus-page:not(.profile-page) .activity-summary,
.nexus-page:not(.profile-page) .document-title { font-size: 13px; }
.nexus-page:not(.profile-page) .activity-meta,
.nexus-page:not(.profile-page) .document-meta { margin-top: 3px; font-size: 11px; }
.nexus-page:not(.profile-page) .home-documents { background: #fcfdff; }
.nexus-page:not(.profile-page) .home-documents .nexus-panel-body { padding-bottom: 18px; }

.nexus-page:not(.profile-page) .nexus-actions { display: grid; gap: 20px; }
.nexus-section-heading h2 { margin: 4px 0 0; color: #17233a; font-size: 19px; letter-spacing: -.025em; }
.nexus-section-heading p { margin: 5px 0 0; color: #748197; font-size: 13px; }
.nexus-page:not(.profile-page) .nexus-action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.nexus-page:not(.profile-page) .nexus-action-card {
  display: flex;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--nexus-border);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(19, 42, 76, .035);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast), border-color var(--motion-fast);
}
.nexus-page:not(.profile-page) .nexus-action-card:hover { border-color: #cbd8ea; box-shadow: var(--nexus-shadow-sm); color: inherit; transform: translateY(-2px); }
.nexus-page:not(.profile-page) .nexus-action-card:active { transform: translateY(0); }
.nexus-page:not(.profile-page) .nexus-action-card:focus-visible,
.nexus-page:not(.profile-page) .home-panel-link:focus-visible,
.nexus-page:not(.profile-page) .document-title:focus-visible { outline: 3px solid rgba(30, 90, 168, .42); outline-offset: 3px; }
.nexus-page:not(.profile-page) .nexus-action-card .home-action-icon { background: #eef5ff; color: #2360aa; }
.nexus-page:not(.profile-page) .nexus-action-card:nth-child(3n+2) .home-action-icon { background: #e9f7f2; color: #238159; }
.nexus-page:not(.profile-page) .nexus-action-card:nth-child(3n) .home-action-icon { background: #f2effc; color: #6d56b4; }

/* Directorio de usuarios */
.nexus-page:not(.profile-page).nexus-page--users { gap: 24px; }
.nexus-page:not(.profile-page) .nexus-page-header--users { align-items: flex-end; }
.nexus-page:not(.profile-page) .user-directory { padding: 0; }
.nexus-page:not(.profile-page) .user-directory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 24px; border-bottom: 1px solid #edf0f4; }
.nexus-page:not(.profile-page) .user-directory-toolbar > div:first-child { flex: 1 1 auto; min-width: 0; }
.nexus-page:not(.profile-page) .user-directory-toolbar .panel-title { margin: 0; color: #17233a; font-size: 18px; }
.nexus-page:not(.profile-page) .user-directory-toolbar .panel-sub { margin: 4px 0 0; color: #7a879a; }
.nexus-page:not(.profile-page) .user-directory-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; gap: 12px; min-width: 0; }
.nexus-page:not(.profile-page) .user-search-form { display: flex; align-items: center; flex: 0 0 420px; gap: 10px; width: 420px; min-width: 0; padding: 6px 8px 6px 14px; border: 1px solid #dfe6ef; border-radius: 12px; background: #f9fbfd; }
.nexus-page:not(.profile-page) .user-search-form > i { color: #748197; font-size: 13px; }
.nexus-page:not(.profile-page) .user-search-form .input { flex: 1 1 280px; min-width: 0; height: 34px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.nexus-page:not(.profile-page) .user-search-form .input:focus { box-shadow: none; }
.nexus-page:not(.profile-page) .user-search-form .btn { height: 36px; padding: 0 15px; border-radius: 8px; background: #fff; }
.nexus-page:not(.profile-page) .user-directory-body { padding: 0; }
.nexus-page:not(.profile-page) .user-directory .table-wrap {
  border: 0 !important;
  border-radius: 0 !important;
  border-top: 0 !important;
  background: transparent !important;
}
.nexus-page:not(.profile-page) .user-identity { display: flex; align-items: center; gap: 11px; min-width: 170px; }
.nexus-page:not(.profile-page) .user-identity > span:last-child { display: grid; gap: 3px; }
.nexus-page:not(.profile-page) .user-identity strong { color: #19263b; font-size: 13px; }
.nexus-page:not(.profile-page) .user-identity span span,
.nexus-page:not(.profile-page) .user-department,
.nexus-page:not(.profile-page) .user-no-role { color: #8490a3; font-size: 11px; }
.nexus-page:not(.profile-page) .user-avatar { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: #e8f1fd; color: #2360aa; font-size: 12px; font-weight: 700; }
.nexus-page:not(.profile-page) .user-role { color: #34425a; font-size: 12px; font-weight: 600; }
.nexus-page:not(.profile-page) .user-row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.nexus-page:not(.profile-page) .user-row-actions form { margin: 0; }
.nexus-page:not(.profile-page) .user-edit-action { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 11px; }

/* Detalle documental */
.nexus-page:not(.profile-page).nexus-page--document-detail { gap: 32px; }
.nexus-page:not(.profile-page) .document-page-intro { align-items: flex-start; }
.nexus-page:not(.profile-page) .document-header-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.nexus-page:not(.profile-page) .document-category-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 8px; background: #eef5ff; color: #285e9f; font-size: 11px; font-weight: 600; }
.nexus-page:not(.profile-page) .document-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.nexus-page:not(.profile-page) .document-header-actions .btn { min-height: 42px; padding: 0 14px; }
.nexus-page:not(.profile-page) .document-detail-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(280px, .85fr); gap: 32px !important; margin: 0 !important; }
.nexus-page:not(.profile-page) .document-description { margin: 0 0 22px; color: #3f4d64; font-size: 14px; line-height: 1.65; }
.nexus-page:not(.profile-page) .document-description p { margin: 0; }
.nexus-page:not(.profile-page) .document-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.nexus-page:not(.profile-page) .document-meta-item { display: grid; min-height: 72px; align-content: center; gap: 7px; padding: 14px 15px; border: 1px solid #edf0f4; border-radius: 12px; background: #fbfcfe; }
.nexus-page:not(.profile-page) .document-meta-item > span:first-child { color: #7b8799; font-size: 10px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.nexus-page:not(.profile-page) .document-meta-item strong { color: #26354d; font-size: 13px; }
.nexus-page:not(.profile-page) .document-detail-admin { align-self: start; }
.nexus-page:not(.profile-page) .document-admin-state { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.nexus-page:not(.profile-page) .document-admin-state span { color: #7b8799; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.nexus-page:not(.profile-page) .document-admin-state strong { color: #293850; font-size: 13px; }
.nexus-page:not(.profile-page) .document-admin-action { margin-top: 8px; }
.nexus-page:not(.profile-page) .document-admin-action .btn { width: 100%; min-height: 40px; }
.nexus-page:not(.profile-page) .document-destructive { border-color: #efc1c5; color: #b42318; }
.nexus-page:not(.profile-page) .document-reactivate { border-color: #b9dfcc; color: #237a4b; }
.nexus-page:not(.profile-page) .document-admin-note { margin: 0; color: #7b8799; font-size: 12px; line-height: 1.5; }
.nexus-page:not(.profile-page) .document-attachments-head { align-items: center; padding-bottom: 20px !important; }
.nexus-page:not(.profile-page) .document-attachments-body { padding: 0; }
.nexus-page:not(.profile-page) .document-attachments .table-wrap {
  border: 0 !important;
  border-radius: 0 !important;
  border-top: 0 !important;
  background: transparent !important;
}
.nexus-page:not(.profile-page) .attachments-action-head,
.nexus-page:not(.profile-page) .attachments-action-cell { text-align: center; }
.nexus-page:not(.profile-page) .attachment-checksum { display: inline-flex; max-width: 104px; overflow: hidden; padding: 4px 6px; border-radius: 6px; background: #f2f5f8; color: #66758c; font-family: "JetBrains Mono Pilot", monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.nexus-page:not(.profile-page) .attachment-download { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 11px; }

.nexus-page:not(.profile-page) .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1023px) {
  .nexus-page:not(.profile-page) .nexus-home-workgrid,
  .nexus-page:not(.profile-page) .document-detail-layout { grid-template-columns: minmax(0, 1fr); }
  .nexus-page:not(.profile-page) .nexus-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

@media (max-width: 700px) {
  .nexus-page:not(.profile-page) { gap: 24px; }
  .nexus-page:not(.profile-page) .nexus-page-header--users { align-items: flex-start; flex-direction: column; gap: 16px; }
  .nexus-page:not(.profile-page) .nexus-panel-header { padding: 18px 16px 14px; }
  .nexus-page:not(.profile-page) .nexus-panel-body { padding: 0 16px 18px; }
  .nexus-page:not(.profile-page) .nexus-action-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .nexus-page:not(.profile-page) .nexus-action-card { padding: 16px; }
  .nexus-page:not(.profile-page) .user-directory-toolbar { align-items: stretch; flex-direction: column; padding: 16px 16px 14px; gap: 14px; }
  .nexus-page:not(.profile-page) .user-directory-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .nexus-page:not(.profile-page) .user-search-form { flex: 0 1 auto; width: 100%; min-width: 0; }
  .nexus-page:not(.profile-page) .user-search-form .btn { flex: 0 0 auto; }
  .nexus-page:not(.profile-page) .user-identity { min-width: 0; }
  .nexus-page:not(.profile-page) .user-identity strong,
  .nexus-page:not(.profile-page) .user-identity span span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nexus-page:not(.profile-page) .document-header-actions { width: 100%; justify-content: stretch; }
  .nexus-page:not(.profile-page) .document-header-actions .btn { flex: 1 1 150px; justify-content: center; }
  .nexus-page:not(.profile-page) .document-meta-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .nexus-page:not(.profile-page) .document-meta-item { min-height: 0; padding: 12px 13px; }
  .nexus-page:not(.profile-page) .document-attachments-head { align-items: flex-start; }
}

/* ========================================================================== */
/* NEXUS canonical content system                                             */
/* The page modifiers are canonical NEXUS contracts; views should consume     */
/* these names for content-level primitives.                                  */
/* ========================================================================== */
.nexus-page {
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-6);
  min-width: 0;
}

.nexus-page-header,
.nexus-page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--nexus-space-5);
  min-width: 0;
}

.nexus-page-title,
.nexus-page-header h1,
.nexus-page-intro h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 700;
  line-height: 1.12;
  text-wrap: balance;
}

.nexus-page-description {
  margin: var(--nexus-space-2) 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 68ch;
}

.nexus-page-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: var(--nexus-space-2);
  flex-wrap: wrap;
}

.nexus-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--nexus-space-2);
  min-height: 32px;
  color: var(--link);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--motion-fast), background-color var(--motion-fast);
}
.nexus-back-link:hover { color: var(--link); }
.nexus-back-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.nexus-btn,
.nexus-btn-primary,
.nexus-btn-secondary,
.nexus-btn-danger,
.nexus-btn-ghost,
.nexus-btn-icon {
  min-height: 36px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font: 600 13px/1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.nexus-btn-primary { background: var(--brand-blue-primary); color: #fff; }
.nexus-btn-primary:hover { background: var(--brand-blue-hover); }
.nexus-btn-secondary { border-color: var(--border); background: #fff; }
.nexus-btn-secondary:hover { background: var(--surface-soft); }
.nexus-btn-danger { border-color: #e6b6ba; background: #fff; color: var(--danger); }
.nexus-btn-danger:hover { background: var(--danger-bg); }
.nexus-btn-ghost { background: transparent; color: var(--muted); }
.nexus-btn-ghost:hover { background: var(--surface-soft); color: var(--text); }
.nexus-btn-icon { width: 36px; padding: 0; }
.nexus-btn:focus-visible,
.nexus-btn-primary:focus-visible,
.nexus-btn-secondary:focus-visible,
.nexus-btn-danger:focus-visible,
.nexus-btn-ghost:focus-visible,
.nexus-btn-icon:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.nexus-btn:disabled,
.nexus-btn-primary:disabled,
.nexus-btn-secondary:disabled,
.nexus-btn-danger:disabled,
.nexus-btn-ghost:disabled,
.nexus-btn-icon:disabled { cursor: not-allowed; opacity: .6; }
.nexus-btn:active,
.nexus-btn-primary:active,
.nexus-btn-secondary:active,
.nexus-btn-danger:active,
.nexus-btn-ghost:active,
.nexus-btn-icon:active { transform: scale(.985); }
.nexus-btn.is-loading,
.nexus-btn-primary.is-loading,
.nexus-btn-secondary.is-loading,
.nexus-btn-danger.is-loading,
.nexus-btn-ghost.is-loading,
.nexus-btn-icon.is-loading,
.nexus-btn[aria-busy="true"] { opacity: .75; pointer-events: none; }
.nexus-btn.is-loading,
.nexus-btn-primary.is-loading,
.nexus-btn-secondary.is-loading,
.nexus-btn-danger.is-loading,
.nexus-btn-ghost.is-loading,
.nexus-btn-icon.is-loading,
.nexus-btn[aria-busy="true"] { position: relative; }
.nexus-btn.is-loading::after,
.nexus-btn-primary.is-loading::after,
.nexus-btn-secondary.is-loading::after,
.nexus-btn-danger.is-loading::after,
.nexus-btn-ghost.is-loading::after,
.nexus-btn-icon.is-loading::after,
.nexus-btn[aria-busy="true"]::after {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
  animation: nexus-spin 700ms linear infinite;
}
.nexus-btn-icon.is-loading::after { right: 50%; transform: translate(50%, -50%); }
@keyframes nexus-spin { to { transform: rotate(360deg); } }

.nexus-card,
.nexus-panel,
.nexus-panel-compact {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.nexus-card-header,
.nexus-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--nexus-space-4);
  min-width: 0;
  padding: var(--nexus-space-5) var(--nexus-space-6);
  border-bottom: 1px solid var(--border-soft);
}
.nexus-card-header > :first-child,
.nexus-panel-header > :first-child,
.nexus-card-body > :first-child,
.nexus-panel-body > :first-child { min-width: 0; }
.nexus-card-title,
.nexus-panel-title {
  margin: 0;
  color: var(--brand-blue-deep);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}
.nexus-card-description,
.nexus-panel-description {
  margin: var(--nexus-space-1) 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.nexus-card-body,
.nexus-panel-body {
  min-width: 0;
  padding: var(--nexus-space-5) var(--nexus-space-6);
}
.nexus-card-footer,
.nexus-panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--nexus-space-2);
  min-width: 0;
  padding: var(--nexus-space-4) var(--nexus-space-6);
  border-top: 1px solid var(--border-soft);
}
.nexus-panel-compact .nexus-panel-header,
.nexus-panel-compact .nexus-panel-body,
.nexus-panel-compact .nexus-panel-footer,
.nexus-panel-compact .nexus-card-header,
.nexus-panel-compact .nexus-card-body,
.nexus-panel-compact .nexus-card-footer { padding: 16px 20px; }

.profile-identity-body { display: flex; align-items: center; gap: 14px; }
.profile-avatar { display: grid; place-items: center; flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; background: var(--info-bg); color: var(--brand-blue-interaction); font-size: 18px; font-weight: 800; }
.profile-identity-copy { min-width: 0; }
.profile-identity-copy h2 { margin: 0; color: var(--text); font-size: 17px; }
.profile-identity-copy p { margin: 3px 0 8px; color: var(--muted); font-size: 12px; }
.profile-readonly-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.profile-readonly-item { display: grid; gap: 4px; min-width: 0; }
.profile-readonly-item strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.profile-readonly-item small { color: var(--muted); font-size: 10px; }

@media (max-width: 700px) {
  .profile-readonly-grid { grid-template-columns: minmax(0, 1fr); }
  .nexus-card-header:has(.nexus-btn) { align-items: stretch; flex-direction: column; }
  .nexus-card-header:has(.nexus-btn) .nexus-btn { align-self: flex-start; }
}

.nexus-form { display: flex; flex-direction: column; gap: 24px; }
.nexus-form-section { display: flex; flex-direction: column; gap: 14px; }
.nexus-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nexus-label,
.nexus-field > label { color: var(--text); font-size: 12px; font-weight: 700; }
.nexus-input,
.nexus-select,
.nexus-textarea,
.nexus-file-input,
.nexus-form .input,
.nexus-form .select,
.nexus-form textarea,
.nexus-form input[type="text"],
.nexus-form input[type="email"],
.nexus-form input[type="number"],
.nexus-form input[type="date"],
.nexus-form input[type="password"],
.nexus-form input[type="file"] {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font: 400 13px/1.35 var(--font-ui);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.nexus-textarea,
.nexus-form textarea { min-height: 96px; resize: vertical; }
.nexus-input[readonly],
.nexus-select[readonly],
.nexus-textarea[readonly],
.nexus-form input[readonly],
.nexus-form textarea[readonly] {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
  cursor: text;
}
.nexus-input:disabled,
.nexus-select:disabled,
.nexus-textarea:disabled,
.nexus-form input:disabled,
.nexus-form select:disabled,
.nexus-form textarea:disabled {
  background: #f2f4f7;
  color: var(--muted);
  cursor: not-allowed;
  opacity: .7;
}
.nexus-input:focus-visible,
.nexus-select:focus-visible,
.nexus-textarea:focus-visible,
.nexus-file-input:focus-visible,
.nexus-form input:focus-visible,
.nexus-form select:focus-visible,
.nexus-form textarea:focus-visible {
  border-color: var(--brand-blue-interaction);
  outline: 3px solid var(--focus-ring-soft);
  outline-offset: 0;
}
.input:focus-visible,
.select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.nexus-help { color: var(--muted); font-size: 12px; line-height: 1.4; }
.nexus-error { color: var(--danger); font-size: 12px; line-height: 1.4; }

.nexus-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.nexus-badge-success { color: var(--success); background: var(--success-bg); }
.nexus-badge-info { color: var(--info); background: var(--info-bg); }
.nexus-badge-warning { color: var(--warning); background: var(--warning-bg); }
.nexus-badge-danger { color: var(--danger); background: var(--danger-bg); }
.nexus-badge-neutral { color: #475467; background: #f2f4f7; }

.nexus-empty-state,
.empty {
  min-height: 0;
  padding: 28px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-soft);
  text-align: center;
}
.nexus-empty-state-icon,
.empty-icon { display: block; width: 40px; height: 40px; margin: 0 auto 10px; font-size: 18px; }
.nexus-empty-state-title,
.empty-title { display: block; color: var(--brand-blue-deep); font-size: 16px; font-weight: 700; }
.nexus-empty-state-text,
.empty-text { display: block; margin: 6px auto 0; color: var(--muted); font-size: 13px; line-height: 1.4; max-width: 48ch; }
.nexus-empty-state-action { margin-top: 16px; }

.nexus-icon { display: inline-grid; place-items: center; width: 1.1em; height: 1.1em; flex: 0 0 auto; }
.nexus-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .nexus-page { gap: var(--nexus-space-4); }
  .nexus-page-header,
  .nexus-page-intro { flex-direction: column; gap: var(--nexus-space-3); }
  .nexus-page-actions { width: 100%; justify-content: flex-start; }
  .nexus-page-actions > .nexus-btn,
  .nexus-page-actions > .btn { flex: 1 1 auto; }
  .nexus-card-header,
  .nexus-card-body,
  .nexus-card-footer { padding: 16px; }
}

/* NEXUS institutional data surfaces: canonical tables, toolbars and actions. */
.nexus-table-module {
  overflow: hidden;
  border: 1px solid #e3e9f0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(19, 42, 76, .035) !important;
}
.nexus-table-toolbar {
  min-height: 0 !important;
  padding: 18px 20px 14px !important;
  border-bottom: 1px solid #e7edf3 !important;
  background: #fff !important;
}
.nexus-table-module > .nexus-table-module-body { padding: 0 !important; }
.nexus-table-wrap {
  margin: 0 !important;
  overflow-x: auto;
  border: 0 !important;
  border-top: 0 !important;
  border-radius: 0 !important;
  background: #fff !important;
  scrollbar-color: #cbd5e1 #f8fafc;
}
.nexus-table {
  width: 100%;
  min-width: 800px;
  font-family: var(--font-ui) !important;
  border: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0;
  background: #fff;
}
.nexus-table thead th {
  height: 38px;
  padding: 0 14px !important;
  background: #f7f9fc !important;
  color: #637188 !important;
  border: 0 !important;
  border-bottom: 1px solid #e1e8ef !important;
  font-size: 10px !important;
  font-weight: 750 !important;
  font-family: var(--font-ui) !important;
  letter-spacing: .055em !important;
  line-height: 1.2 !important;
  text-align: center !important;
  text-transform: uppercase !important;
  vertical-align: middle;
}
.nexus-table thead th:first-child { text-align: left !important; }
.nexus-table thead th + th { border-left: 1px solid #edf1f5 !important; }
.nexus-table tbody td {
  min-height: 52px;
  padding: 13px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid #e7edf3 !important;
  border-left: 1px solid #edf1f5 !important;
  color: #34425a;
  font-size: 12px;
  line-height: 1.4;
  text-align: center !important;
  vertical-align: middle !important;
}
.nexus-table tbody td:first-child {
  border-left: 0 !important;
  color: #26354d;
  text-align: left !important;
}
.nexus-table tbody tr:last-child td { border-bottom: 0 !important; }
.nexus-table tbody tr:hover td { background: #fbfdff; }
.nexus-table .nexus-table-col-text { text-align: left !important; }
.nexus-table-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 32px;
  white-space: nowrap;
}
.nexus-table-actions form { display: inline-flex; align-items: center; }
.nexus-table-actions .btn { flex: 0 0 auto; }
.nexus-table .table-actions,
.nexus-table .table-actions-heading { text-align: center !important; }
.nexus-table-empty,
.nexus-table .nexus-table-empty { padding: 30px 18px !important; color: #7a879a; text-align: center !important; }
.nexus-table--key-value { min-width: 0; }
.nexus-table--key-value tbody td:first-child,
.nexus-table--key-value tbody td:nth-child(2) { text-align: left !important; }
.nexus-table--key-value tbody td + td { border-left: 0 !important; }

.nexus-toolbar {
  border: 1px solid #e3e9f0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(19, 42, 76, .035) !important;
}
.nexus-toolbar form {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center !important;
  gap: 10px !important;
}
.nexus-toolbar input:not([type="checkbox"]),
.nexus-toolbar select,
.nexus-toolbar .input,
.nexus-toolbar .select,
.nexus-toolbar .form-control {
  min-height: 36px;
  height: 36px;
  box-sizing: border-box;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
  background: #fff;
  color: #26354d;
  font: inherit;
}
.nexus-toolbar input:focus-visible,
.nexus-toolbar select:focus-visible,
.nexus-toolbar .form-control:focus-visible {
  outline: 3px solid var(--focus-ring-soft);
  outline-offset: 1px;
  border-color: var(--brand-blue-interaction);
}
.nexus-toolbar .btn { min-height: 36px; height: 36px; }
.nexus-toolbar .btn-ghost { border: 1px solid transparent; }

@media (max-width: 700px) {
  .nexus-table-module { border-radius: 10px !important; }
  .nexus-table-toolbar { padding: 14px 16px 12px !important; }
  .nexus-table { min-width: 720px; }
  .nexus-table th, .nexus-table td { padding-left: 10px !important; padding-right: 10px !important; }
  .nexus-table-wrap { max-width: 100%; }
  .nexus-toolbar { border-radius: 10px !important; }
  .nexus-toolbar form > * { flex: 1 1 100%; min-width: 0 !important; max-width: none !important; }
.nexus-toolbar .btn, .nexus-toolbar a.btn { justify-content: center; }
  .nexus-table--key-value { min-width: 0; }
}

@media (min-width: 701px) {
  .nexus-toolbar form > input,
  .nexus-toolbar form > select,
  .nexus-toolbar form > .input,
  .nexus-toolbar form > .select { width: auto !important; max-width: none !important; flex: 1 1 160px; }
  .nexus-toolbar form > input[type="search"],
  .nexus-toolbar form > input[type="text"] { flex-basis: 260px; }
}




/* ==========================================================================\n+   MODALS\n+   ========================================================================== */
.nexus-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(11, 35, 71, 0.45);
  backdrop-filter: blur(4px);
  overscroll-behavior: contain;
}

.nexus-modal-backdrop.is-open { display: grid; }

.nexus-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  animation: nexus-modal-pop var(--motion-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

.nexus-modal-sm { max-width: 360px; }
.nexus-modal-md { max-width: 420px; }
.nexus-modal-lg { max-width: 640px; }

.nexus-modal-header {
  flex: 0 0 auto;
  padding: 24px;
  text-align: center;
}

.nexus-modal-title {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.nexus-modal-description {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.nexus-modal-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--brand-red);
  font-size: 22px;
}

.nexus-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.nexus-modal-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: var(--surface-soft);
  border-top: 1px solid var(--border-soft);
}

.nexus-modal-footer form { display: flex; }

.nexus-modal-close {
  flex: 0 0 auto;
  margin-left: auto;
}

@keyframes nexus-modal-pop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 700px) {
  .nexus-modal-backdrop { padding: 12px; }
  .nexus-modal { max-height: calc(100dvh - 24px); }
  .nexus-modal-footer { flex-wrap: wrap; }
  .nexus-modal-footer > .nexus-btn,
  .nexus-modal-footer > form { flex: 1 1 140px; }
  .nexus-modal-footer > form .nexus-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .nexus-modal { animation: none; }
}

/* Segunda propagación: roles, auditoría y notificaciones comparten la jerarquía aprobada. */
.nexus-page:not(.profile-page).nexus-page--roles,
.nexus-page:not(.profile-page).nexus-page--audit,
.nexus-page:not(.profile-page).nexus-page--audit-detail,
.nexus-page:not(.profile-page).nexus-page--notifications,
.nexus-page:not(.profile-page).nexus-page--notification-detail { gap: 24px; }
.nexus-page:not(.profile-page) .role-directory,
.nexus-page:not(.profile-page) .audit-directory,
.nexus-page:not(.profile-page) .notification-directory,
.nexus-page:not(.profile-page) .audit-filter-surface,
.nexus-page:not(.profile-page) .notification-tabs,
.nexus-page:not(.profile-page) .notification-detail-surface { padding: 0; border: 1px solid var(--nexus-border); border-top: 1px solid var(--nexus-border) !important; border-radius: 16px; background: var(--nexus-surface); box-shadow: var(--nexus-shadow-sm); overflow: hidden; }
.nexus-page:not(.profile-page) .role-directory-toolbar,
.nexus-page:not(.profile-page) .audit-directory-toolbar,
.nexus-page:not(.profile-page) .notification-directory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 24px; border-bottom: 1px solid #edf0f4; }
.nexus-page:not(.profile-page) .role-directory-toolbar .panel-title,
.nexus-page:not(.profile-page) .audit-directory-toolbar .panel-title,
.nexus-page:not(.profile-page) .notification-directory-toolbar .panel-title { margin: 0; color: #17233a; font-size: 18px; }
.nexus-page:not(.profile-page) .role-directory-toolbar .panel-sub,
.nexus-page:not(.profile-page) .audit-directory-toolbar .panel-sub,
.nexus-page:not(.profile-page) .notification-directory-toolbar .panel-sub { margin-top: 4px; color: #7a879a; }
.nexus-page:not(.profile-page) .role-directory-body,
.nexus-page:not(.profile-page) .audit-directory-body,
.nexus-page:not(.profile-page) .notification-directory-body { padding: 0; }
.nexus-page:not(.profile-page) .role-directory .table-wrap,
.nexus-page:not(.profile-page) .audit-directory .table-wrap,
.nexus-page:not(.profile-page) .notification-directory .table-wrap { border: 0 !important; border-top: 0 !important; border-radius: 0 !important; background: transparent !important; }
.nexus-page:not(.profile-page) .role-identity { display: flex; align-items: center; gap: 10px; color: #19263b; font-size: 13px; }
.nexus-page:not(.profile-page) .role-avatar { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #eef5ff; color: #2360aa; }
.nexus-page:not(.profile-page) .role-permissions { display: flex; flex-wrap: wrap; gap: 4px; max-width: 520px; }
.nexus-page:not(.profile-page) .role-no-permissions { color: #8490a3; font-size: 11px; }
.nexus-page:not(.profile-page) .compact-action { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 11px; white-space: nowrap; }
.nexus-page:not(.profile-page) .compact-empty-state { display: grid; justify-items: center; gap: 7px; max-width: 100%; padding: 28px 20px; color: #7a879a; text-align: center; white-space: normal; }
.nexus-page:not(.profile-page) .compact-empty-state strong { color: #26354d; font-size: 14px; }
.nexus-page:not(.profile-page) .compact-empty-state > span:not(.compact-empty-icon) { font-size: 12px; }
.nexus-page:not(.profile-page) .compact-empty-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 2px; border-radius: 50%; background: #f1f5fa; color: #8294ab; }
.nexus-page:not(.profile-page) .compact-empty-action { margin-top: 4px; min-height: 34px; padding: 0 12px; font-size: 11px; }
.nexus-page:not(.profile-page) .audit-filter-surface { padding: 16px 20px; overflow: visible; }
.nexus-page:not(.profile-page) .audit-filter-form { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(170px, 1.15fr) minmax(150px, 1fr) minmax(130px, .8fr) minmax(130px, .8fr) auto; gap: 12px; align-items: end; }
.nexus-page:not(.profile-page) .audit-filter-form > div { min-width: 0; }
.nexus-page:not(.profile-page) .audit-filter-form label { display: block; margin-bottom: 5px; color: #637188; font-size: 11px; font-weight: 700; }
.nexus-page:not(.profile-page) .audit-filter-form .form-control { width: 100%; height: 36px; font-size: 13px; }
.nexus-page:not(.profile-page) .audit-filter-actions { display: flex; gap: 8px; }
.nexus-page:not(.profile-page) .audit-filter-actions .btn { min-height: 36px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.nexus-page:not(.profile-page) .technical-value { color: #66758c; font-family: "JetBrains Mono Pilot", monospace; font-size: 11px; }
.nexus-page:not(.profile-page) .muted-value { color: #8490a3; font-size: 12px; }
.nexus-page:not(.profile-page) .audit-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: #f1f5fa; color: #65758c; font-size: 11px; font-weight: 700; }
.nexus-page:not(.profile-page) .audit-create,
.nexus-page:not(.profile-page) .audit-activate,
.nexus-page:not(.profile-page) .audit-login { background: #e8f6ef; color: #237a4b; }
.nexus-page:not(.profile-page) .audit-update,
.nexus-page:not(.profile-page) .audit-role_assign,
.nexus-page:not(.profile-page) .audit-permission_change { background: #eef5ff; color: #285e9f; }
.nexus-page:not(.profile-page) .audit-delete,
.nexus-page:not(.profile-page) .audit-deactivate,
.nexus-page:not(.profile-page) .audit-login_failed { background: #fff0f0; color: #b42318; }
.nexus-page:not(.profile-page) .audit-detail-layout { display: grid; grid-template-columns: minmax(280px, .62fr) minmax(0, 1.38fr); gap: 24px; align-items: start; }
.nexus-page:not(.profile-page) .audit-metadata-panel,
.nexus-page:not(.profile-page) .audit-payload-panel { min-width: 0; }
.nexus-page:not(.profile-page) .audit-metadata-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.nexus-page:not(.profile-page) .audit-metadata-grid > div { display: grid; gap: 5px; min-width: 0; margin: 0 !important; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.nexus-page:not(.profile-page) .audit-metadata-grid > div:last-child { border-bottom: 0; }
.nexus-page:not(.profile-page) .audit-metadata-grid > div > div:first-child { color: #7b8799 !important; font-size: 10px !important; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.nexus-page:not(.profile-page) .audit-payload-panel .nexus-panel-body { padding-top: 0; }
.nexus-page:not(.profile-page) .audit-payload { min-height: 280px; max-height: 520px; margin: 0; overflow: auto; padding: 18px; border: 1px solid #e4eaf1; border-radius: 10px; background: #f7f9fc; color: #34425a; font-family: "JetBrains Mono Pilot", monospace; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.nexus-page:not(.profile-page) .notification-backlink { margin-bottom: 8px; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-header { padding: 18px 24px; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body { padding: 20px 24px 24px; }

@media (max-width: 1023px) {
  .nexus-page:not(.profile-page) .audit-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nexus-page:not(.profile-page) .audit-filter-actions { grid-column: 1 / -1; }
  .nexus-page:not(.profile-page) .audit-detail-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .nexus-page:not(.profile-page) .role-directory-toolbar,
  .nexus-page:not(.profile-page) .audit-directory-toolbar,
  .nexus-page:not(.profile-page) .notification-directory-toolbar { align-items: flex-start; flex-direction: column; padding: 16px; gap: 12px; }
  .nexus-page:not(.profile-page) .audit-filter-surface { padding: 14px 16px; }
  .nexus-page:not(.profile-page) .audit-filter-form { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .nexus-page:not(.profile-page) .audit-filter-actions { grid-column: auto; }
  .nexus-page:not(.profile-page) .audit-filter-actions .btn { flex: 1 1 0; justify-content: center; }
  .nexus-page:not(.profile-page) .audit-detail-intro { gap: 12px; }
  .nexus-page:not(.profile-page) .audit-detail-intro > .btn { width: 100%; justify-content: center; }
  .nexus-page:not(.profile-page) .notification-directory .table-wrap { overflow: visible; }
  .nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-header,
  .nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body { padding-left: 16px; padding-right: 16px; }
}

/* Compactación final de las vistas de revisión: no altera shell, topbar ni sidebar. */
.nexus-page:not(.profile-page).nexus-page--roles,
.nexus-page:not(.profile-page).nexus-page--audit,
.nexus-page:not(.profile-page).nexus-page--audit-detail,
.nexus-page:not(.profile-page).nexus-page--notifications,
.nexus-page:not(.profile-page).nexus-page--notification-detail { gap: 20px; }
  .nexus-page:not(.profile-page) .nexus-panel-header { min-height: 0; }
.nexus-page:not(.profile-page) .role-directory-toolbar,
.nexus-page:not(.profile-page) .audit-directory-toolbar,
.nexus-page:not(.profile-page) .notification-directory-toolbar { padding: 14px 20px; }
.nexus-page:not(.profile-page) .role-directory-toolbar .nexus-table-module-meta,
.nexus-page:not(.profile-page) .audit-directory-toolbar .nexus-table-module-meta,
.nexus-page:not(.profile-page) .notification-directory-toolbar .nexus-table-module-meta { margin-top: 3px; }
.nexus-page:not(.profile-page) .compact-empty-state { gap: 5px; padding: 20px 16px; }
.nexus-page:not(.profile-page) .compact-empty-icon { width: 32px; height: 32px; margin-bottom: 0; }
.nexus-page:not(.profile-page) .compact-empty-action { margin-top: 2px; }
.nexus-page:not(.profile-page) .audit-filter-surface { padding: 12px 16px !important; }
.nexus-page:not(.profile-page) .audit-filter-form { gap: 10px; }
.nexus-page:not(.profile-page) .audit-detail-layout { gap: 20px; }
.nexus-page:not(.profile-page) .audit-metadata-grid > div { padding: 9px 0; }
.nexus-page:not(.profile-page) .audit-payload-panel .nexus-panel-header { padding: 16px 20px 12px; }
.nexus-page:not(.profile-page) .audit-payload-panel .nexus-panel-body { padding: 0 20px 20px; }
.nexus-page:not(.profile-page) .audit-payload { min-height: 0; max-height: 420px; padding: 14px; line-height: 1.55; }
.nexus-page:not(.profile-page) .notification-tabs { margin-bottom: 0 !important; }
.nexus-page:not(.profile-page) .notification-tabs .panel-body { padding: 8px 14px !important; }
.nexus-page:not(.profile-page) .notification-detail-surface { margin-bottom: 0 !important; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-header { padding: 16px 20px; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body { padding: 16px 20px 20px; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body > div:first-child { gap: 12px !important; padding-bottom: 12px !important; margin-bottom: 12px !important; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body > div:last-child { margin-top: 8px !important; }
.nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body > div:last-child > div { padding: 12px 14px !important; }

@media (max-width: 700px) {
  .nexus-page:not(.profile-page) .role-directory-toolbar,
  .nexus-page:not(.profile-page) .audit-directory-toolbar,
  .nexus-page:not(.profile-page) .notification-directory-toolbar { padding: 14px 16px; gap: 10px; }
  .nexus-page:not(.profile-page) .audit-filter-surface { padding: 12px 14px !important; }
  .nexus-page:not(.profile-page) .audit-payload-panel .nexus-panel-header { padding: 14px 16px 10px; }
  .nexus-page:not(.profile-page) .audit-payload-panel .nexus-panel-body { padding: 0 16px 16px; }
  .nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-header { padding: 14px 16px; }
  .nexus-page:not(.profile-page) .notification-detail-surface .nexus-panel-body { padding: 14px 16px 16px; }
}

/* Precedencia sobre los defaults estructurales y márgenes inline de estas vistas. */
.nexus-page.is-active:not(.profile-page).nexus-page--roles,
.nexus-page.is-active:not(.profile-page).nexus-page--audit,
.nexus-page.is-active:not(.profile-page).nexus-page--audit-detail,
.nexus-page.is-active:not(.profile-page).nexus-page--notifications,
.nexus-page.is-active:not(.profile-page).nexus-page--notification-detail { gap: 20px; }
.nexus-page.is-active:not(.profile-page).nexus-page--audit > .audit-toolbar,
.nexus-page.is-active:not(.profile-page).nexus-page--notifications > .notification-tabs,
.nexus-page.is-active:not(.profile-page).nexus-page--notification-detail > .notification-detail-surface { margin-bottom: 0 !important; }

/* La separación entre módulos la gobierna el grid de la página, no márgenes implícitos de panel. */
.nexus-page.is-active:not(.profile-page).nexus-page--audit > .panel,
.nexus-page.is-active:not(.profile-page).nexus-page--notifications > .nexus-filter-module,
.nexus-page.is-active:not(.profile-page).nexus-page--roles > .panel { margin-top: 0 !important; }

@media (min-width: 701px) {
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--audit),
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--audit-detail),
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--notifications),
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--notification-detail) { padding-top: 18px; }
}

/* Terceros y Clientes: misma superficie, densidad y lectura que Usuarios/Auditoría. */
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-list,
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-detail,
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-edit { gap: 20px; }
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-list > .panel,
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-edit > .panel { margin-top: 0 !important; }
.third-filter-surface { padding: 0 !important; overflow: visible !important; }
.third-filter-surface .panel-body { padding: 12px 16px !important; }
.third-filter-surface form { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.third-filter-surface .input,
.third-filter-surface .select { min-height: 36px; }
.third-directory { overflow: hidden; }
.third-directory-toolbar { min-height: 0 !important; padding: 16px 20px !important; }
.third-directory .panel-body { padding: 0 !important; }
.third-code { display: block; color: #285e9f; font-family: "JetBrains Mono Pilot", monospace; font-size: 12px; }
.third-name { display: block; color: #19263b; font-size: 13px; }
.third-secondary { display: block; margin-top: 3px; color: #7a879a; font-size: 11px; line-height: 1.35; }
.third-status { display: inline-flex; min-height: 24px; align-items: center; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.third-status.is-active { background: #e8f6ef; color: #237a4b; }
.third-status.is-inactive { background: #fff0f0; color: #b42318; }
.third-row-actions { display: inline-flex; gap: 6px; }
.third-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid #edf0f4; color: #7a879a; font-size: 12px; }
.third-pagination > div { display: flex; gap: 6px; }
.third-detail-stack { margin: 0 !important; gap: 20px !important; }
.third-detail-stack > .nexus-panel { min-width: 0; }
.third-nexus-surface .nexus-panel-header { padding: 18px 20px 12px; min-height: 0; }
.third-data-body { padding: 0 20px 20px !important; }
.third-advance-surface table { display: block; width: 100%; border-collapse: separate !important; }
.third-advance-surface table tbody { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.third-advance-surface table tr { display: grid; grid-template-columns: minmax(105px, .8fr) minmax(0, 1.4fr); align-content: start; min-width: 0; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.third-advance-surface table tr:last-child { border-bottom: 0; }
.third-advance-surface table td { min-width: 0; min-height: 0 !important; height: auto !important; padding: 0 6px 0 0 !important; border: 0 !important; }
.third-advance-surface table td:first-child { color: #7b8799; font-size: 11px; }
.third-advance-surface table td:last-child { color: #26354d; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.third-nexus-surface .third-data-body > div:first-child { gap: 16px !important; }
.third-nexus-surface .third-data-body > div:first-child > div { min-width: 0; }
.third-nexus-surface .third-data-body > div:last-child { margin-top: 16px !important; padding-top: 14px !important; }
.third-backlink { margin-bottom: 6px; }
.third-detail-meta { margin-top: 6px; color: #64748b; font-size: 13px; }
.nexus-page.is-active:not(.profile-page).nexus-page--audit-detail .audit-payload { min-height: 0; max-height: none; overflow: visible; }
.nexus-page.is-active:not(.profile-page).nexus-page--notification-detail .notification-detail-surface { min-height: 0; }
.third-advance-surface { border-top: 1px solid var(--nexus-border) !important; }
.third-advance-surface table tbody { align-content: start; grid-auto-rows: max-content; }
.third-advance-surface table tr { height: auto !important; min-height: 0 !important; padding-top: 8px; padding-bottom: 8px; }
.third-status-badge { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-detail .third-detail-stack {
  align-items: start;
  grid-auto-rows: max-content;
}
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-detail .third-detail-stack > .third-advance-surface,
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-detail .third-detail-stack > .third-nexus-surface {
  align-self: start;
  height: auto;
  min-height: 0;
}
.nexus-page.is-active:not(.profile-page).nexus-page--third-party-detail .third-nexus-surface .third-data-body {
  height: auto;
  min-height: 0;
}
.nexus-page.is-active:not(.profile-page).nexus-page--audit-detail .audit-detail-layout {
  align-items: start;
  grid-auto-rows: max-content;
}
.nexus-page.is-active:not(.profile-page).nexus-page--audit-detail .audit-metadata-panel,
.nexus-page.is-active:not(.profile-page).nexus-page--audit-detail .audit-payload-panel {
  align-self: start;
  height: auto;
  min-height: 0 !important;
}

@media (min-width: 701px) {
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--third-party-list),
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--third-party-detail),
  .workspace:has(.nexus-page.is-active:not(.profile-page).nexus-page--third-party-edit) { padding-top: 18px; }
}

@media (max-width: 700px) {
  .third-filter-surface .panel-body { padding: 10px 14px !important; }
  .third-filter-surface form { align-items: stretch; }
  .third-filter-surface form > * { flex: 1 1 100%; max-width: none !important; }
  .third-directory-toolbar { padding: 14px 16px !important; }
  .third-advance-surface table tbody { grid-template-columns: minmax(0, 1fr); }
  .third-advance-surface table tr { grid-template-columns: minmax(110px, .9fr) minmax(0, 1.5fr); }
  .third-data-body { padding: 0 16px 16px !important; }
}








.table-actions-heading, .table-actions { text-align: right; }
.table-actions > div { display: flex; justify-content: flex-end; gap: 4px; }

/* Notification segmented control: tabs behave as one compact control. */
.nexus-page.is-active:not(.profile-page).nexus-page--notifications { animation: none !important; }
.nexus-page.is-active:not(.profile-page) .notification-tabs {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #f7f9fc;
  box-shadow: none;
  overflow: hidden;
}
.nexus-page.is-active:not(.profile-page) .notification-tabs .panel-body {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.nexus-page.is-active:not(.profile-page) .notification-tabs .panel-body::-webkit-scrollbar { display: none; }
@media (max-width: 700px) {
  .nexus-page--third-party-edit { gap: 16px; }
}

/* Canonical tab API. Keep navigation stable; only visual color surfaces transition. */
.nexus-tabs,
.tabs,
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--border-soft, #e3e9f0);
  border-radius: 12px;
  background: var(--surface-soft, #f7f9fc);
  padding: 4px;
  box-sizing: border-box;
}
.nexus-tabs::-webkit-scrollbar,
.tabs::-webkit-scrollbar,
.tabs-bar::-webkit-scrollbar { display: none; }

.nexus-tab,
.tab,
.tab-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #526079);
  font-family: var(--font-ui, inherit);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  transform: none !important;
  box-sizing: border-box;
}
.nexus-tab:hover,
.tab:hover,
.tab-btn:hover {
  border-color: var(--border, #d8dee7);
  background: #ffffff;
  color: var(--brand-blue-deep, #293854);
}
.nexus-tab:focus-visible,
.tab:focus-visible,
.tab-btn:focus-visible {
  outline: 3px solid var(--focus-ring, rgba(65, 118, 252, 0.4));
  outline-offset: 1px;
}
.nexus-tab:active,
.tab:active,
.tab-btn:active {
  transform: none !important;
}
.nexus-tab.is-active,
.nexus-tab.active,
.tab.is-active,
.tab.active,
.tab-btn.is-active,
.tab-btn.active {
  border-color: var(--brand-blue-primary, #3566e8);
  background: var(--brand-blue-primary, #3566e8);
  color: #ffffff !important;
}

.nexus-tab-count,
.nexus-tab .badge,
.tab .badge,
.tab-btn .badge {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #dce9f8;
  color: var(--brand-blue-deep, #293854);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.nexus-tab.is-active .nexus-tab-count,
.nexus-tab.active .nexus-tab-count,
.nexus-tab.is-active .badge,
.nexus-tab.active .badge,
.tab.is-active .badge,
.tab.active .badge,
.tab-btn.is-active .badge,
.tab-btn.active .badge {
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-blue-interaction, #4176fc);
}

/* Last-mile canonical table invariants override legacy page selectors. */
.nexus-table-wrap { border-top: 0 !important; border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important; }
.nexus-table { border-top: 0 !important; }
.nexus-table th, .nexus-table td { text-align: center !important; border-left: 1px solid #edf1f5 !important; }
.nexus-table th:first-child, .nexus-table td:first-child { text-align: left !important; border-left: 0 !important; }
.nexus-table .nexus-table-col-text { text-align: left !important; }
.nexus-table .nexus-table-actions { justify-content: center !important; align-items: center !important; }
.nexus-table--key-value th, .nexus-table--key-value td,
.nexus-table--key-value th:first-child, .nexus-table--key-value td:first-child { text-align: left !important; border-left: 0 !important; }


@media (max-width: 700px) {
  .nexus-tabs { border-radius: 10px; }
  .nexus-tabs .panel-body { max-width: 100%; }

  /* Keep dense audit filters readable on narrow viewports. */
  .audit-toolbar.nexus-toolbar form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 10px !important;
  }
  .audit-toolbar.nexus-toolbar form > div {
    width: auto !important;
    min-width: 0 !important;
  }
  .audit-toolbar.nexus-toolbar form > div:last-child {
    grid-column: 1 / -1;
  }
  .audit-toolbar.nexus-toolbar form > div:last-child .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Second-pass listing composition: filter and result surfaces remain siblings. */
.nexus-filter-module,
.nexus-table-module {
  min-width: 0;
  overflow: hidden;
}
.nexus-filter-module {
  padding: 0 !important;
}
.nexus-filter-module > .nexus-toolbar,
.nexus-filter-module > .user-directory-toolbar,
.nexus-filter-module > .third-filter-surface,
.nexus-filter-module > .audit-toolbar {
  min-height: 0;
  padding: 18px 20px !important;
  border: 0;
  border-radius: inherit;
  background: var(--surface);
}
.nexus-filter-module .nexus-toolbar form,
.nexus-filter-module > .nexus-toolbar form,
.nexus-filter-module > .third-filter-surface form,
.nexus-filter-module > .audit-toolbar form {
  gap: 12px !important;
}
.nexus-filter-module input:not([type="checkbox"]),
.nexus-filter-module select,
.nexus-filter-module .input,
.nexus-filter-module .select,
.nexus-filter-module .form-control,
.nexus-filter-module .btn {
  min-height: 36px;
  height: 36px;
}
.nexus-table-module > .nexus-table-module-header {
  min-height: 0;
  padding: 16px 20px 14px;
}
.nexus-table-module > .nexus-table-module-body {
  padding: 0 !important;
}
.nexus-table-module > .nexus-table-wrap,
.nexus-table-module .nexus-table-wrap {
  border-top: 1px solid var(--border-soft) !important;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.nexus-table-module .nexus-table {
  border-radius: 0;
}
.nexus-table-module .nexus-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Canonical detail metadata/content primitives. These replace repeated inline presentation. */
.nexus-detail-title { margin-top: 4px; }
.nexus-detail-metadata { font-size: 13px; }
.nexus-detail-metadata-item { margin-bottom: 12px; }
.nexus-detail-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nexus-detail-value { color: var(--text); }
.nexus-detail-value-strong { font-weight: 700; }
.nexus-detail-muted { color: var(--muted); }
.nexus-detail-italic { font-style: italic; }
.nexus-detail-inline-badge { margin-top: 4px; }
.nexus-notification-detail-actions,
.nexus-notification-badges { display: flex; align-items: center; gap: 8px; }
.nexus-notification-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.nexus-notification-content { margin-top: 12px; }
.nexus-notification-message,
.nexus-notification-structured-body {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
  color: var(--text);
}
.nexus-notification-message {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.nexus-notification-structured { margin-top: 20px; }
.nexus-notification-structured-body {
  padding: 12px 16px;
  font-size: 12px;
}
.nexus-notification-structured-body ul { margin: 0; padding-left: 18px; }
.nexus-notification-unread-dot { font-size: 8px; }
.nexus-notification-priority-critical { background: rgba(220, 53, 69, .12); color: #c62828; font-weight: 700; }
.nexus-notification-priority-important { background: rgba(245, 124, 0, .12); color: #e65100; font-weight: 600; }
.nexus-notification-priority-normal { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--border-soft); }
.nexus-notification-unread { background: var(--brand-blue-soft); color: var(--brand-blue-deep); font-weight: 600; }

@media (max-width: 640px) {
  .nexus-notification-detail-actions,
  .nexus-notification-badges { align-items: stretch; flex-wrap: wrap; }
  .nexus-notification-detail-actions > * { flex: 1 1 auto; }
}

@media (max-width: 700px) {
  .nexus-filter-module > .nexus-toolbar,
  .nexus-filter-module > .user-directory-toolbar,
  .nexus-filter-module > .third-filter-surface,
  .nexus-filter-module > .audit-toolbar { padding: 16px !important; }
  .nexus-table-module > .nexus-table-module-header { padding: 14px 16px 12px !important; }
}


/* Canonical table component: one institutional treatment across every listing. */
.nexus-table-module {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e3e9f0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(19, 42, 76, .035) !important;
}
.nexus-table-wrap {
  min-width: 0;
  overflow-x: auto !important;
  overflow-y: hidden;
  border: 1px solid #e3e9f0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  scrollbar-color: #cbd5e1 #f8fafc;
}
.nexus-table-module > .nexus-table-wrap,
.nexus-table-module .nexus-table-wrap {
  border: 0 !important;
  border-top: 1px solid #e3e9f0 !important;
  border-radius: 0 0 12px 12px !important;
}
.nexus-table {
  width: 100%;
  min-width: 800px;
  border: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0;
  background: #fff !important;
}
.nexus-table thead th {
  height: 44px !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-bottom: 1px solid #dfe7ef !important;
  border-left: 1px solid #e3e9f0 !important;
  background: #f4f7fb !important;
  color: #42526a !important;
  font-size: 10px !important;
  font-weight: 750 !important;
  letter-spacing: .055em;
  line-height: 1.2;
  text-align: center !important;
  text-transform: uppercase;
  vertical-align: middle !important;
}
.nexus-table thead th:first-child {
  border-left: 0 !important;
  text-align: left !important;
}
.nexus-table tbody td {
  height: 50px !important;
  min-height: 0 !important;
  padding: 14px !important;
  border: 0 !important;
  border-bottom: 1px solid #e3e9f0 !important;
  border-left: 1px solid #e3e9f0 !important;
  background: #fff;
  color: #34425a;
  font-size: 12px;
  line-height: 1.4;
  text-align: center !important;
  vertical-align: middle !important;
}
.nexus-table tbody td:first-child {
  border-left: 0 !important;
  color: #26354d;
  text-align: left !important;
}
.nexus-table tbody tr:nth-child(even) td { background: #f8fafc; }
.nexus-table tbody tr:hover td { background: #f1f6fb !important; }
.nexus-table tbody tr:last-child td { border-bottom: 0 !important; }
.nexus-table .nexus-table-col-text { text-align: left !important; }
.nexus-table .table-actions,
.nexus-table .table-actions-heading,
.nexus-table-actions { text-align: center !important; }
.nexus-table .nexus-table-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 32px;
  white-space: nowrap;
}
.nexus-table-actions form { display: inline-flex; align-items: center; }
.nexus-table-empty,
.nexus-table .nexus-table-empty {
  padding: 24px 18px !important;
  background: #fff !important;
  color: #7a879a;
  text-align: center !important;
}
.nexus-table--key-value { min-width: 0; }
.nexus-table--key-value thead th,
.nexus-table--key-value tbody td,
.nexus-table--key-value tbody td:first-child {
  border-left: 0 !important;
  text-align: left !important;
}
.nexus-table-pagination {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px;
  padding: 12px 16px !important;
  border-top: 1px solid #e3e9f0 !important;
  color: #7a879a;
  font-size: 12px;
}
.nexus-table-pagination > div {
  display: flex !important;
  align-items: center;
  gap: 6px;
}
.nexus-table-pagination :is(.btn, .nexus-btn) { min-height: 32px; padding: 0 10px; }

@media (max-width: 700px) {
  .nexus-table-wrap { max-width: 100%; }
  .nexus-table { min-width: 0; }
  .nexus-table-pagination {
    align-items: stretch !important;
    flex-direction: column;
  }
  .nexus-table-pagination > div { flex-wrap: wrap; }
}

[data-theme="dark"] .nexus-table-module {
  border-color: var(--border-soft) !important;
  background: var(--surface-elevated) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18) !important;
}
[data-theme="dark"] .nexus-table-wrap {
  border-color: var(--border-soft) !important;
  background: var(--surface-elevated) !important;
  scrollbar-color: #475467 #1D232D;
}
[data-theme="dark"] .nexus-table-module .nexus-table-wrap {
  border-top-color: var(--border-soft) !important;
}
[data-theme="dark"] .nexus-table {
  border-color: var(--border-soft) !important;
  background: var(--surface-elevated) !important;
}
[data-theme="dark"] .nexus-table thead th {
  border-bottom-color: var(--border-soft) !important;
  border-left-color: var(--border-soft) !important;
  background: var(--surface-subtle) !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .nexus-table tbody td {
  border-bottom-color: var(--border-soft) !important;
  border-left-color: var(--border-soft) !important;
  background: var(--surface-elevated) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .nexus-table tbody tr:nth-child(even) td {
  background: var(--surface-soft) !important;
}
[data-theme="dark"] .nexus-table tbody tr:hover td {
  background: var(--surface-subtle) !important;
}
[data-theme="dark"] .nexus-table tbody td:first-child {
  color: var(--text) !important;
}
[data-theme="dark"] .nexus-table-empty,
[data-theme="dark"] .nexus-table .nexus-table-empty {
  background: var(--surface-elevated) !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .nexus-table-pagination {
  border-top-color: var(--border-soft) !important;
  color: var(--text-secondary) !important;
}

/* Cierre de unificación visual: headers, superficies y tablas comparten una
   única geometría institucional. Las interacciones conservan únicamente
   transiciones cromáticas; la navegación no desplaza el contenido. */
.nexus-page { gap: var(--nexus-space-5); }
.nexus-form-surface {
  width: 100% !important;
  max-width: none !important;
}
.nexus-page:not(.profile-page) .home-header { border-left: 0 !important; }
@media (min-width: 701px) {
  .workspace:has(.nexus-page.is-active:not(.profile-page)) { padding-top: 24px !important; }
}
.nexus-page-header,
.nexus-page-intro,
.page-header {
  position: relative;
  align-items: flex-start;
  gap: var(--nexus-space-5);
  margin-bottom: 0 !important;
  padding: 0 0 0 18px !important;
  border-bottom: 0 !important;
}
.nexus-page-header::before,
.nexus-page-intro::before,
.page-header::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 3px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--brand-red) 46%, transparent);
}
.nexus-page-header h1,
.nexus-page-intro h1,
.page-header h1 { margin: 0 !important; }
.nexus-page-description,
.page-header p[style*="font-size"] { margin-top: 8px !important; }

.nexus-page:not(.profile-page).nexus-page--document-detail { gap: 20px; }

/* Canonical form system: the form surface owns its complete visual contract. */
.nexus-form-surface {
  width: 100%;
  max-width: 1180px;
  overflow: hidden;
}
.nexus-form-surface > .nexus-card-header,
.nexus-form-surface > .nexus-card-body { box-sizing: border-box; }
.nexus-form-surface > .nexus-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.nexus-form-surface > .nexus-card-body { padding: 20px 24px 22px; }
.nexus-form-surface .nexus-card-header .nexus-card-title,
.nexus-form-surface .nexus-card-header h2 {
  margin: 0;
  color: var(--brand-blue-deep);
  font-size: 15px;
  letter-spacing: -.01em;
}
.nexus-form-surface .nexus-card-header .nexus-card-description,
.nexus-form-surface .nexus-card-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.nexus-form { display: grid; gap: 22px; }
.nexus-form-section {
  display: grid;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}
.nexus-form-section:first-child { padding-top: 0; border-top: 0; }
.nexus-form-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.nexus-form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -.01em;
}
.nexus-form-section-title i { color: var(--brand-blue-interaction); font-size: 13px; }
.nexus-form-section-description,
.nexus-help { color: var(--muted); font-size: 11px; line-height: 1.4; }
.nexus-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 20px;
}
.nexus-form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nexus-field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.nexus-field-full { grid-column: 1 / -1; }
.nexus-field-narrow { max-width: 520px; }
.nexus-label,
.nexus-field > label { color: var(--text); font-size: 12px; font-weight: 700; }
.nexus-required { color: var(--brand-red); }
.nexus-input,
.nexus-select,
.nexus-textarea,
.nexus-file-input,
.nexus-form input:not([type="checkbox"]):not([type="radio"]),
.nexus-form select,
.nexus-form textarea {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font: 400 13px/1.35 var(--font-ui);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.nexus-textarea,
.nexus-form textarea { min-height: 106px; resize: vertical; }
.nexus-file-input,
.nexus-form input[type="file"] { padding: 7px 10px; }
.nexus-input:focus-visible,
.nexus-select:focus-visible,
.nexus-textarea:focus-visible,
.nexus-file-input:focus-visible,
.nexus-form input:focus-visible,
.nexus-form select:focus-visible,
.nexus-form textarea:focus-visible {
  border-color: var(--brand-blue-interaction);
  outline: 3px solid var(--focus-ring-soft);
  outline-offset: 0;
}
.nexus-error { color: var(--brand-red); font-size: 11px; line-height: 1.35; }
.nexus-form-error {
  padding: 10px 12px;
  border: 1px solid #e6b6ba;
  border-radius: var(--radius-control);
  background: var(--danger-bg);
  color: var(--brand-red);
  font-size: 12px;
}
.nexus-choice-list {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
}
.nexus-choice-list ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 9px;
  max-height: 360px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}
.nexus-choice-list li label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 34px;
  padding: 8px 9px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
}
.nexus-choice-list li label:hover { border-color: var(--brand-blue-interaction); background: #fbfdff; }
.nexus-checkbox,
.nexus-radio,
.nexus-choice-list input[type="checkbox"],
.nexus-check-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--brand-blue-interaction);
}
.nexus-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
}
.nexus-check-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.nexus-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
@media (max-width: 700px) {
  .nexus-form-surface > .nexus-card-header,
  .nexus-form-surface > .nexus-card-body { padding-left: 16px; padding-right: 16px; }
  .nexus-form-grid,
  .nexus-form-grid-2,
  .nexus-choice-list ul { grid-template-columns: minmax(0, 1fr); }
  .nexus-field-full { grid-column: auto; }
  .nexus-form-section-header { align-items: stretch; flex-direction: column; }
  .nexus-form-actions { flex-wrap: wrap; }
  .nexus-form-actions .nexus-btn { flex: 1 1 auto; justify-content: center; }
}

.nexus-filter-module,
.nexus-table-module {
  border: 1px solid #e3e9f0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(19, 42, 76, .035) !important;
}
.nexus-filter-module > .nexus-toolbar,
.nexus-filter-module > .user-directory-toolbar,
.nexus-filter-module > .third-filter-surface,
.nexus-filter-module > .audit-toolbar {
  padding: 16px 20px !important;
  background: #fff !important;
}
.nexus-filter-module form { align-items: center !important; }
.nexus-filter-module input:not([type="checkbox"]),
.nexus-filter-module select,
.nexus-filter-module .input,
.nexus-filter-module .select,
.nexus-filter-module .form-control,
.nexus-filter-module .btn { height: 36px; min-height: 36px; }

.nexus-table-module > .nexus-table-module-header { padding: 16px 20px 14px !important; }
.nexus-table-module .nexus-table th,
.nexus-table-module .nexus-table td {
  height: auto;
  padding: 12px 14px !important;
}
.nexus-table-module .nexus-table th {
  height: 38px;
  background: #f7f9fc !important;
}
.nexus-table-module .nexus-table tbody td { min-height: 0; }
.nexus-table-module .nexus-table .table-actions,
.nexus-table-module .nexus-table .table-actions-heading,
.nexus-table-module .nexus-table .nexus-table-actions { text-align: center !important; }

@media (max-width: 700px) {
  .workspace:has(.nexus-page.is-active:not(.profile-page)) { padding-top: 18px !important; }
  .nexus-page { gap: var(--nexus-space-4); }
  .nexus-page-header,
  .nexus-page-intro,
  .page-header { gap: var(--nexus-space-3); padding-left: 14px !important; }
  .nexus-page-header::before,
  .nexus-page-intro::before,
  .page-header::before,
  .nexus-page:not(.profile-page) .page-header::before { width: 4px; }
  .nexus-filter-module > .nexus-toolbar,
  .nexus-filter-module > .user-directory-toolbar,
  .nexus-filter-module > .third-filter-surface,
  .nexus-filter-module > .audit-toolbar { padding: 14px 16px !important; }
  .nexus-table-module > .nexus-table-module-header { padding: 14px 16px 12px !important; }
}

/* Final cascade lock: table geometry stays canonical. */
.nexus-table-module .nexus-table thead th {
  height: 44px !important;
  padding: 0 14px !important;
  background: #f4f7fb !important;
  border-bottom: 1px solid #dfe7ef !important;
}
.nexus-table-module .nexus-table tbody td {
  height: 50px !important;
  min-height: 0 !important;
  padding: 14px !important;
}
.nexus-table-module .nexus-table thead th:first-child,
.nexus-table-module .nexus-table tbody td:first-child { text-align: left !important; }

/* Canonical page-header geometry. Module modifiers may style the content,
   but they must not change the shared header height, rhythm or alignment. */
.nexus-page { gap: var(--nexus-space-5) !important; }
.nexus-page-header,
.nexus-page-intro,
.page-header {
  display: flex;
  align-items: flex-start !important;
  justify-content: space-between;
  gap: 20px;
  min-height: 104px;
  min-width: 0;
  margin: 0 !important;
  padding: var(--nexus-space-4) 0 var(--nexus-space-4) var(--nexus-space-5) !important;
  border: 0 !important;
}
.nexus-page-header::before,
.nexus-page-intro::before,
.page-header::before {
  display: block;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  border-radius: 4px;
}
.nexus-page-header-content,
.nexus-page-header > div:first-child,
.nexus-page-intro > div:first-child,
.page-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.nexus-page-header > div:last-child,
.nexus-page-intro > div:last-child,
.page-header > div:last-child { padding-top: 0 !important; }
.nexus-page-title,
.nexus-page-header h1,
.nexus-page-intro h1,
.page-header h1 {
  margin: 0 !important;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: clamp(26px, 2vw, 32px) !important;
  font-weight: 700;
  line-height: 1.12 !important;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.nexus-page-description,
.nexus-page-header p,
.nexus-page-intro p,
.page-header p {
  margin: var(--nexus-space-2) 0 0 !important;
  color: var(--muted);
  font-size: 14px !important;
  line-height: 1.45 !important;
  max-width: 68ch;
}
.nexus-page-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
  gap: var(--nexus-space-2);
  max-width: 48%;
  min-width: 0;
  flex-wrap: wrap;
}
.nexus-page-actions.nexus-context-card {
  max-width: none;
  margin: 0;
  justify-content: center;
}
.nexus-page-header .document-header-meta { margin-top: 12px; }

@media (max-width: 700px) {
  .nexus-page { gap: var(--nexus-space-4) !important; }
  .nexus-page-header,
  .nexus-page-intro,
  .page-header {
    align-items: stretch !important;
    flex-direction: column;
    gap: var(--nexus-space-3);
    justify-content: flex-start;
    min-height: 0;
    padding: 14px 0 14px 16px !important;
  }
  .nexus-page-actions,
  .nexus-page-actions.nexus-context-card {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }
  .nexus-page-actions > .btn { flex: 1 1 auto; }
}
.nexus-table-module .nexus-table thead th:not(:first-child),
.nexus-table-module .nexus-table tbody td:not(:first-child) { text-align: center !important; }

/* Canonical table family: module-specific modifiers remain only for content
   and responsive column visibility; geometry belongs to nexus-table. */
@media (min-width: 701px) {
  .nexus-table-module > .nexus-table-module-header,
  .nexus-table-module > .nexus-table-module-body {
    min-width: 0;
  }

  .nexus-table-module > .nexus-table-module-header {
    min-height: 76px !important;
    padding: 16px 20px !important;
    border-bottom: 0 !important;
  }

  .nexus-table-module > .nexus-table-module-body {
    padding: 0 !important;
  }

  .nexus-table-module .nexus-table-wrap {
    border: 0 !important;
    border-top: 1px solid #e3e9f0 !important;
    border-radius: 0 0 12px 12px !important;
  }

  .nexus-table-module .nexus-table {
    min-width: 800px;
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0;
  }

  .nexus-table-module .nexus-table thead th {
    height: 44px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-bottom: 1px solid #dfe7ef !important;
    border-left: 1px solid #e3e9f0 !important;
    background: #f4f7fb !important;
    color: #42526a !important;
    line-height: 1.2 !important;
    text-align: center !important;
    vertical-align: middle !important;
  }

  .nexus-table-module .nexus-table thead th:first-child {
    border-left: 0 !important;
    text-align: left !important;
  }

  .nexus-table-module .nexus-table tbody td {
    height: 50px !important;
    min-height: 0 !important;
    padding: 14px !important;
    border: 0 !important;
    border-bottom: 1px solid #e3e9f0 !important;
    border-left: 1px solid #e3e9f0 !important;
    background: #fff !important;
    line-height: 1.4 !important;
    text-align: center !important;
    vertical-align: middle !important;
  }

  .nexus-table-module .nexus-table tbody td:first-child {
    border-left: 0 !important;
    text-align: left !important;
  }

  .nexus-table-module .nexus-table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
  }

  .nexus-table-module .nexus-table tbody tr:hover td {
    background: #f1f6fb !important;
  }

  .nexus-table-module .nexus-table tbody tr:last-child td {
    border-bottom: 0 !important;
  }

  .nexus-table-module .nexus-table .nexus-table-actions {
    min-height: 36px;
    justify-content: center !important;
    gap: 6px !important;
  }

  .nexus-table-module .nexus-table .nexus-table-actions .nexus-btn-icon {
    flex: 0 0 36px;
    width: 36px;
    min-height: 36px;
    padding: 0 !important;
  }

  .nexus-table-module .nexus-table .nexus-badge {
    min-height: 24px !important;
    height: 24px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    line-height: 12px !important;
    vertical-align: middle;
  }

  .nexus-table-module .nexus-table .nexus-table-empty {
    height: auto !important;
    min-height: 112px !important;
    padding: 28px 20px !important;
    background: #fff !important;
    text-align: center !important;
  }

  .nexus-table-module .nexus-table-pagination {
    min-height: 60px;
    padding: 12px 20px !important;
  }
}

/* Canonical internal grammar for data-table cells. Module classes may retain
   responsive visibility rules, but no longer define typography or geometry. */
.nexus-table-cell-stack {
  display: grid;
  min-width: 0;
  gap: 4px;
  align-content: center;
}
.nexus-table-cell-title {
  display: block;
  min-width: 0;
  color: #26354d;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}
.nexus-table-cell-meta {
  display: block;
  min-width: 0;
  margin: 0;
  color: #7a879a;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}
.nexus-table-cell-primary,
.nexus-table-cell-text {
  color: #34425a;
  font-size: 12px;
  line-height: 1.4;
}
.nexus-table-cell-primary { display: inline-flex; align-items: center; gap: 4px; }
.nexus-table-cell-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nexus-table-cell-avatar-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.nexus-table-cell-avatar {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #eef5ff;
  color: #2360aa;
}
.nexus-table-cell-icon {
  color: #7a879a;
  font-size: 12px;
}
.nexus-table-cell-icon-column {
  width: 40px;
  text-align: center !important;
}
.nexus-table-cell-code {
  color: #285e9f;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
}
.nexus-table .nexus-badge {
  min-height: 24px !important;
  height: 24px !important;
  padding: 0 8px !important;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 700;
  line-height: 12px !important;
  vertical-align: middle;
}
.nexus-table--key-value tbody td,
.nexus-table--key-value tbody td:first-child,
.nexus-table--key-value tbody td:nth-child(2) {
  height: auto !important;
  min-height: 0 !important;
  padding: 12px 14px !important;
  text-align: left !important;
  border-left: 0 !important;
}
.nexus-table--key-value tbody tr:last-child td {
  border-bottom: 0 !important;
}

/* Final table surface lock: Documentos is the canonical full-bleed table
   surface. The module owns the border, radius, and clipping. */
.nexus-table-module {
  border-color: #dfe7ef !important;
  overflow: hidden !important;
}
.nexus-table-module > .nexus-table-module-body {
  padding: 0 !important;
}
.nexus-table-module .nexus-table-wrap {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow-x: auto !important;
}
.nexus-table-module .nexus-table thead th,
.nexus-table-module .nexus-table tbody td {
  border-color: #dfe7ef !important;
}
.nexus-table-module .nexus-table .nexus-btn-icon {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius-control) !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.nexus-table-module .nexus-table .nexus-btn-icon:hover {
  border-color: transparent !important;
  background: var(--surface-soft) !important;
  color: var(--brand-blue-interaction) !important;
  box-shadow: none !important;
  transform: none !important;
}
.nexus-table-module .nexus-table .nexus-btn-icon:focus-visible {
  outline: 3px solid var(--focus-ring) !important;
  outline-offset: 2px;
}
.nexus-table-module .nexus-table tbody td.nexus-table-empty,
.nexus-table-module .nexus-table tbody td:has(.nexus-empty-state) {
  min-height: 0 !important;
  height: 112px !important;
  padding: 20px !important;
}

/* Canonical table-module header. This is the reusable hierarchy shared by
   every listing and detail table. */
.nexus-table-module > .nexus-table-module-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: var(--nexus-space-4) !important;
  min-height: 0 !important;
  padding: var(--nexus-space-4) var(--nexus-space-5) !important;
  border: 0 !important;
  background: var(--surface) !important;
}
.nexus-table-module-body {
  min-width: 0;
  padding: 0 !important;
}
.nexus-table-module-heading {
  flex: 1 1 auto;
  min-width: 0;
}
.nexus-table-module-title {
  margin: 3px 0 0 !important;
  color: var(--text) !important;
  font-family: var(--font-heading) !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}
.nexus-table-module-meta {
  margin: 5px 0 12px !important;
  color: var(--muted) !important;
  font-family: var(--font-ui) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
}
.nexus-table-module-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
@media (max-width: 700px) {
  .nexus-table-module > .nexus-table-module-header {
    flex-wrap: wrap;
    padding: 16px !important;
  }
  .nexus-table-module-actions {
    width: 100%;
  }
}

/* Canonical module typography owns listing directory headings. */
.nexus-table-module > .nexus-table-module-header .nexus-table-module-title {
  margin: 3px 0 0 !important;
  color: #17233a !important;
  font-family: var(--font-heading) !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

.nexus-table-module > .nexus-table-module-header .nexus-table-module-meta {
  margin: 5px 0 12px !important;
  color: #7a879a !important;
  font-family: var(--font-ui) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
}

/* Canonical toolbars and filters: distribution only; controls keep their own API. */
.nexus-toolbar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: none;
}
.nexus-toolbar-group,
.nexus-toolbar-filters,
.nexus-toolbar-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.nexus-toolbar-group { flex: 1 1 auto; }
.nexus-toolbar-filters { flex: 1 1 auto; flex-wrap: wrap; }
.nexus-toolbar-actions { flex: 0 0 auto; margin-left: auto; justify-content: flex-end; }
.nexus-toolbar-heading { min-width: 0; }
.nexus-toolbar-heading h2,
.nexus-toolbar-heading h3 { margin: 0; }
.nexus-toolbar-heading p { margin: 4px 0 0; }
.nexus-toolbar-field {
  display: flex;
  flex: 1 1 150px;
  flex-direction: column;
  align-items: stretch;
  min-width: 130px;
  gap: 6px;
}
.nexus-toolbar-field > label { color: var(--text); font-size: 12px; font-weight: 700; }
.nexus-toolbar-search {
  display: flex;
  flex: 1 1 280px;
  align-items: center;
  min-width: 220px;
  height: 36px;
  box-sizing: border-box;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.nexus-toolbar-search > i { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.nexus-toolbar-search .nexus-input,
.nexus-toolbar-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.nexus-toolbar-search .nexus-input,
.nexus-toolbar-search input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.nexus-toolbar-search input:focus-visible {
  outline: 0;
}
.nexus-toolbar-search:focus-within {
  border-color: var(--brand-blue-interaction);
  outline: 3px solid var(--focus-ring-soft);
  outline-offset: 0;
}
.nexus-toolbar > form {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 10px;
}
.nexus-toolbar > form > .nexus-toolbar-search { flex: 1 1 280px; }
.nexus-toolbar > form > .nexus-input,
.nexus-toolbar > form > .nexus-select,
.nexus-toolbar > form > input,
.nexus-toolbar > form > select {
  flex: 0 1 170px;
  width: auto;
  min-width: 140px;
  max-width: 220px;
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
}
.nexus-toolbar .nexus-input,
.nexus-toolbar .nexus-select,
.nexus-toolbar input:not([type="checkbox"]):not([type="radio"]),
.nexus-toolbar select {
  border-color: var(--border);
  border-radius: var(--radius-control);
  font-size: 13px;
}
.nexus-toolbar .nexus-input[type="date"] {
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
}
.nexus-toolbar .nexus-btn,
.nexus-toolbar .nexus-btn-primary,
.nexus-toolbar .nexus-btn-secondary,
.nexus-toolbar .nexus-btn-ghost { flex: 0 0 auto; min-height: 36px; height: 36px; }
.nexus-toolbar-reset { flex: 0 0 auto; }
.nexus-toolbar-actions form { display: flex; align-items: center; }
.nexus-toolbar-actions:has(> .nexus-toolbar-search) { flex: 1 1 auto; }
.nexus-toolbar-actions > .nexus-toolbar-search {
  flex: 1 1 280px;
  width: auto;
  min-width: 220px;
}
.nexus-toolbar.audit-toolbar > form {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  align-items: end;
}
.nexus-toolbar.audit-toolbar > form > .nexus-toolbar-actions {
  align-self: end;
}

/* Canonical surface authority: semantic NEXUS panel zones own presentation. */
.nexus-panel > .nexus-panel-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
  min-width: 0 !important;
  padding: 20px 24px !important;
  border-bottom: 1px solid var(--border-soft) !important;
}
.nexus-panel > .nexus-panel-body {
  min-width: 0 !important;
  padding: 20px 24px !important;
}
.nexus-panel > .nexus-panel-header .nexus-panel-title,
.nexus-panel > .nexus-panel-header .nexus-card-title {
  margin: 0 !important;
  color: var(--brand-blue-deep) !important;
  font-family: var(--font-heading) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
}
.nexus-panel > .nexus-panel-header .nexus-panel-description,
.nexus-panel > .nexus-panel-header .nexus-card-description {
  margin: 4px 0 0 !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
}
.nexus-panel > .nexus-panel-footer { padding: 16px 24px !important; }
@media (max-width: 700px) {
  .nexus-toolbar { align-items: stretch; flex-direction: column; gap: 12px; padding: 12px 16px; }
  .nexus-toolbar-group,
  .nexus-toolbar-filters,
  .nexus-toolbar-actions,
  .nexus-toolbar > form { width: 100%; flex-direction: column; flex-wrap: nowrap; align-items: stretch; height: auto; }
  .nexus-toolbar-actions { margin-left: 0; flex: 0 0 auto; }
  .nexus-toolbar-search,
  .nexus-toolbar > form > .nexus-input,
  .nexus-toolbar > form > .nexus-select,
  .nexus-toolbar > form > input,
  .nexus-toolbar > form > select,
  .nexus-toolbar-field { width: 100%; max-width: none; min-width: 0; flex: 0 0 auto; }
  .nexus-toolbar > form > .nexus-select,
  .nexus-toolbar > form > select {
    flex: 0 0 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.35 !important;
  }
  .nexus-toolbar > form > .nexus-toolbar-search {
    flex: 0 0 36px;
    height: 36px;
  }
  .nexus-toolbar > form > .nexus-toolbar-actions { flex: 0 0 auto; }
  .nexus-toolbar .nexus-btn,
  .nexus-toolbar .nexus-btn-primary,
  .nexus-toolbar .nexus-btn-secondary,
  .nexus-toolbar .nexus-btn-ghost { width: 100%; justify-content: center; }
}

/* Canonical pagination API. Pagination belongs to the table module and does
   not depend on panel-foot or inline sizing. */
.nexus-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.nexus-pagination-info { min-width: 0; }
.nexus-pagination-list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.nexus-pagination-link,
.nexus-pagination-current {
  display: inline-flex;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 10px;
  border-radius: var(--radius-control);
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
}
.nexus-pagination-current {
  background: var(--brand-blue-primary);
  color: #fff;
  font-weight: 700;
}
.nexus-pagination-link[aria-disabled="true"],
.nexus-pagination-link:disabled,
.nexus-pagination-item.is-disabled {
  cursor: not-allowed;
  opacity: .5;
  pointer-events: none;
}
.nexus-pagination-ellipsis {
  display: inline-flex;
  min-width: 24px;
  height: 32px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
@media (max-width: 700px) {
  .nexus-pagination {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 16px;
  }
  .nexus-pagination-list { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .nexus-btn.is-loading::after,
  .nexus-btn-primary.is-loading::after,
  .nexus-btn-secondary.is-loading::after,
  .nexus-btn-danger.is-loading::after,
  .nexus-btn-ghost.is-loading::after,
  .nexus-btn-icon.is-loading::after,
  .nexus-btn[aria-busy="true"]::after { animation: none; }
}

/* Final theme overrides must follow the late canonical table/pagination rules. */
[data-theme="dark"] .nexus-page.is-active:not(.profile-page) {
  --nexus-surface: var(--surface);
  --nexus-surface-muted: var(--surface-elevated);
  --nexus-border: var(--border);
  --nexus-shadow-sm: none;
  --nexus-shadow-md: none;
  color: var(--text);
}

[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-context-card,
[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-panel,
[data-theme="dark"] .nexus-page:not(.profile-page) .home-documents,
[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-action-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-context-icon,
[data-theme="dark"] .nexus-page:not(.profile-page) .activity-icon,
[data-theme="dark"] .nexus-page:not(.profile-page) .document-icon,
[data-theme="dark"] .nexus-page:not(.profile-page) .home-action-icon {
  background: var(--surface-elevated) !important;
  color: var(--brand-blue-accent) !important;
}

[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-context-label,
[data-theme="dark"] .nexus-section-label,
[data-theme="dark"] .nexus-section-heading p,
[data-theme="dark"] .nexus-page:not(.profile-page) .home-lead,
[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-panel-description,
[data-theme="dark"] .nexus-page:not(.profile-page) .activity-meta,
[data-theme="dark"] .nexus-page:not(.profile-page) .document-meta {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-context-card strong,
[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-panel-title,
[data-theme="dark"] .nexus-section-heading h2,
[data-theme="dark"] .nexus-page:not(.profile-page) .activity-summary,
[data-theme="dark"] .nexus-page:not(.profile-page) .document-title,
[data-theme="dark"] .nexus-page:not(.profile-page) .home-action-label {
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-page--document-detail .document-meta-item {
  background: var(--surface-elevated);
  border-color: var(--border);
}
[data-theme="dark"] .nexus-page--document-detail .document-meta-item > span:first-child,
[data-theme="dark"] .nexus-page--document-detail .document-meta-item > span:not(:first-child) {
  color: var(--text-secondary);
}
[data-theme="dark"] .nexus-page--document-detail .document-meta-item strong,
[data-theme="dark"] .nexus-page--document-detail .document-admin-state strong {
  color: var(--text);
}
[data-theme="dark"] .nexus-page--document-detail .document-admin-state > span:first-child,
[data-theme="dark"] .nexus-detail-label {
  color: var(--text-secondary);
}
[data-theme="dark"] .nexus-page--document-detail .document-description {
  color: var(--text-secondary);
}
[data-theme="dark"] .nexus-page--document-detail .attachment-checksum {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
[data-theme="dark"] .nexus-page--third-party-detail .third-detail-meta {
  color: var(--text-secondary);
}
[data-theme="dark"] .nexus-page--third-party-detail .third-detail-meta strong,
[data-theme="dark"] .nexus-page--third-party-detail .third-detail-meta a {
  color: var(--info) !important;
}
[data-theme="dark"] .nexus-page--third-party-detail .third-advance-surface a {
  color: var(--info);
}
[data-theme="dark"] .nexus-page--audit-detail .audit-payload {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .nexus-page:not(.profile-page) .activity-item,
[data-theme="dark"] .nexus-page:not(.profile-page) .document-item {
  border-bottom-color: var(--border-soft) !important;
}

[data-theme="dark"] .nexus-page:not(.profile-page) .activity-item:hover,
[data-theme="dark"] .nexus-page:not(.profile-page) .nexus-action-card:hover {
  background: rgba(65, 118, 252, .08) !important;
}

[data-theme="dark"] .panel,
[data-theme="dark"] .kpi,
[data-theme="dark"] .nexus-card,
[data-theme="dark"] .nexus-panel,
[data-theme="dark"] .nexus-panel-compact,
[data-theme="dark"] .nexus-form-surface,
[data-theme="dark"] .nexus-table-module,
[data-theme="dark"] .nexus-toolbar,
[data-theme="dark"] .nexus-tabs,
[data-theme="dark"] .nexus-modal,
[data-theme="dark"] .nexus-toast {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .kpi,
[data-theme="dark"] .home-action-icon,
[data-theme="dark"] .activity-icon,
[data-theme="dark"] .document-icon,
[data-theme="dark"] .home-context-badge,
[data-theme="dark"] .home-metric {
  border-color: var(--border);
}

[data-theme="dark"] .kpi,
[data-theme="dark"] .home-action-icon,
[data-theme="dark"] .activity-icon {
  background: var(--surface) !important;
}

[data-theme="dark"] .home-metric strong,
[data-theme="dark"] .nexus-card-title,
[data-theme="dark"] .nexus-panel-title,
[data-theme="dark"] .nexus-empty-state-title,
[data-theme="dark"] .empty-title {
  color: var(--text) !important;
}

[data-theme="dark"] .home-action-description,
[data-theme="dark"] .activity-meta,
[data-theme="dark"] .document-meta,
[data-theme="dark"] .kpi-meta,
[data-theme="dark"] .home-context-label,
[data-theme="dark"] .home-panel-link,
[data-theme="dark"] .home-panel .panel-sub {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .activity-item:hover,
[data-theme="dark"] .home-action:hover,
[data-theme="dark"] .activity-link:hover {
  background: rgba(65, 118, 252, .08) !important;
}

[data-theme="dark"] .nexus-table-cell-title,
[data-theme="dark"] .nexus-table-cell-primary,
[data-theme="dark"] .nexus-table-cell-text,
[data-theme="dark"] .nexus-table-cell-code {
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-table-cell-meta,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .nexus-table-cell-code,
[data-theme="dark"] .nexus-mono {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .nexus-badge-success { color: var(--success) !important; background: var(--success-bg) !important; }
[data-theme="dark"] .nexus-badge-warning { color: var(--warning) !important; background: var(--warning-bg) !important; }
[data-theme="dark"] .nexus-badge-danger { color: var(--danger) !important; background: var(--danger-bg) !important; }
[data-theme="dark"] .nexus-badge-info { color: var(--info) !important; background: var(--info-bg) !important; }
[data-theme="dark"] .nexus-badge-neutral { color: var(--neutral-text) !important; background: var(--neutral-bg) !important; }

[data-theme="dark"] .nexus-table-module > .nexus-table-module-header,
[data-theme="dark"] .nexus-table-module > .nexus-table-module-body,
[data-theme="dark"] .nexus-table-wrap,
[data-theme="dark"] .nexus-table {
  background: var(--surface) !important;
}

[data-theme="dark"] .nexus-table thead th {
  background: var(--surface-elevated) !important;
  border-color: var(--border-soft) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .nexus-table-module .nexus-table thead th,
[data-theme="dark"] .nexus-table-module .nexus-table tbody td {
  border-color: var(--border-soft) !important;
}

[data-theme="dark"] .nexus-table tbody td {
  background: var(--surface) !important;
  border-color: var(--border-soft) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-table tbody tr:nth-child(even) td {
  background: var(--surface-input) !important;
}

[data-theme="dark"] .nexus-table tbody tr:hover td {
  background: rgba(65, 118, 252, .12) !important;
  box-shadow: none;
}

[data-theme="dark"] .nexus-table tbody tr:not(:hover) td {
  background: var(--surface) !important;
}

[data-theme="dark"] .nexus-table tbody tr:nth-child(even):not(:hover) td {
  background: var(--surface-input) !important;
}

[data-theme="dark"] .nexus-table-module-title,
[data-theme="dark"] .nexus-table-module > .nexus-table-module-header .nexus-table-module-title {
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-table-module-meta,
[data-theme="dark"] .nexus-table-module > .nexus-table-module-header .nexus-table-module-meta {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .nexus-input,
[data-theme="dark"] .nexus-select,
[data-theme="dark"] .nexus-textarea,
[data-theme="dark"] .nexus-file-input,
[data-theme="dark"] .nexus-form .input,
[data-theme="dark"] .nexus-form .select,
[data-theme="dark"] .nexus-form textarea,
[data-theme="dark"] .nexus-form input,
[data-theme="dark"] .nexus-form select,
[data-theme="dark"] .nexus-toolbar input,
[data-theme="dark"] .nexus-toolbar select,
[data-theme="dark"] .nexus-toolbar .form-control {
  background: var(--surface-input) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-input::placeholder,
[data-theme="dark"] .nexus-textarea::placeholder,
[data-theme="dark"] .nexus-form input::placeholder,
[data-theme="dark"] .nexus-form textarea::placeholder,
[data-theme="dark"] .nexus-toolbar input::placeholder {
  color: var(--text-secondary) !important;
  opacity: 1;
}

/* The search shell owns the border; its input must remain transparent so it
   cannot create a second dark rectangle before the adjacent selects. */
[data-theme="dark"] .nexus-toolbar-search {
  background: var(--surface-input) !important;
  border-color: var(--border-soft) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .nexus-toolbar-search .nexus-input,
[data-theme="dark"] .nexus-toolbar-search input {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

[data-theme="dark"] .nexus-btn-secondary,
[data-theme="dark"] .nexus-btn-danger,
[data-theme="dark"] .nexus-btn-icon {
  background: var(--surface-elevated) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-btn-secondary:hover,
[data-theme="dark"] .nexus-btn-icon:hover,
[data-theme="dark"] .nexus-btn-ghost:hover {
  background: var(--surface-input) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-tab {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .nexus-tab:hover {
  background: var(--surface-elevated) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-tab.is-active,
[data-theme="dark"] .nexus-pagination-current {
  background: var(--brand-blue-primary) !important;
  border-color: var(--brand-blue-primary) !important;
  color: #fff !important;
}

[data-theme="dark"] .nexus-empty-state {
  background: var(--surface-soft) !important;
  border-color: var(--border-strong) !important;
}

[data-theme="dark"] .nexus-empty-state-title {
  color: var(--text) !important;
}

[data-theme="dark"] .nexus-empty-state-text,
[data-theme="dark"] .nexus-table-empty,
[data-theme="dark"] .nexus-pagination,
[data-theme="dark"] .nexus-pagination-ellipsis {
  color: var(--text-secondary) !important;
}

/* Review fixes: keep the Home context card geometry unchanged while centering
   its complete icon + text group within the available inner box. */
.nexus-page--home .nexus-context-card {
  display: grid;
  place-items: center;
  width: 200px;
  height: 58px;
  min-height: 58px;
  padding: 0 16px;
}
.nexus-page--home .nexus-context-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.nexus-page--home .nexus-context-group > span:last-child {
  display: grid;
  gap: 3px;
}

/* Compact toolbar variant: keep a controls-only surface sized to its content
   while preserving the canonical toolbar API and responsive stacking. */
.nexus-toolbar.nexus-toolbar-compact {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  justify-content: flex-end;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.nexus-toolbar-compact > .nexus-toolbar-actions {
  width: auto;
  max-width: 100%;
  justify-content: flex-end;
}
.nexus-toolbar-compact .nexus-toolbar-search {
  flex: 0 1 auto;
  width: clamp(400px, 32vw, 450px);
  max-width: 100%;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
}
.nexus-toolbar-compact .nexus-toolbar-search > i {
  flex: 0 0 auto;
}
.nexus-toolbar-compact .nexus-toolbar-search > input {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
}
.nexus-toolbar-compact .nexus-toolbar-search > .nexus-toolbar-reset {
  flex: 0 0 auto;
}
@media (max-width: 700px) {
  .nexus-toolbar.nexus-toolbar-compact {
    width: 100%;
    padding: 0;
  }
  .nexus-toolbar-compact > .nexus-toolbar-actions {
    width: 100%;
    align-items: stretch;
  }
  .nexus-toolbar-compact .nexus-toolbar-search {
    flex: 0 0 36px;
    width: 100%;
    max-width: none;
    height: 36px;
  }
}

/* Final canonical row-state authority. Legacy Light hover selectors may
   remain for Light Mode, but cannot wash table rows in Dark Mode. */
[data-theme="dark"] .nexus-table tbody tr,
[data-theme="dark"] .nexus-table tbody tr:not(:hover) td {
  background: var(--table-row) !important;
}

[data-theme="dark"] .nexus-table tbody tr:nth-child(even) td {
  background: var(--table-row-zebra) !important;
}

[data-theme="dark"] .nexus-table tbody tr:hover,
[data-theme="dark"] .nexus-table tbody tr:hover td {
  background: var(--table-row-hover) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .nexus-table tbody tr:active,
[data-theme="dark"] .nexus-table tbody tr.is-active,
[data-theme="dark"] .nexus-table tbody tr.selected,
[data-theme="dark"] .nexus-table tbody tr[aria-selected="true"],
[data-theme="dark"] .nexus-table tbody tr:active td,
[data-theme="dark"] .nexus-table tbody tr.is-active td,
[data-theme="dark"] .nexus-table tbody tr.selected td,
[data-theme="dark"] .nexus-table tbody tr[aria-selected="true"] td {
  background: var(--table-row-selected) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .nexus-table tbody tr[class~="is-active"] > td,
[data-theme="dark"] .nexus-table tbody tr[class~="selected"] > td,
[data-theme="dark"] .nexus-table tbody tr[aria-selected="true"] > td {
  background: var(--table-row-selected) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .nexus-table tbody tr:focus,
[data-theme="dark"] .nexus-table tbody tr:focus-visible {
  outline: 2px solid var(--table-row-focus) !important;
  outline-offset: -2px;
}

[data-theme="dark"] .nexus-table tbody tr:focus td,
[data-theme="dark"] .nexus-table tbody tr:focus-visible td,
[data-theme="dark"] .nexus-table tbody td:focus-visible {
  background: var(--table-row-focus) !important;
  color: var(--text) !important;
  outline: none !important;
  box-shadow: inset 0 0 0 1px var(--table-row-focus) !important;
}

/* Profile composition: a compact product surface with a clear identity hierarchy. */
.profile-page { width: min(100%, 1440px); margin: 0 auto; gap: 24px !important; }
.profile-page > .nexus-page-header { min-height: 76px; padding-top: 8px !important; padding-bottom: 8px !important; }
.profile-page > .nexus-page-header { margin-bottom: 18px !important; }
.profile-hero { overflow: hidden; border-color: var(--border); background: linear-gradient(135deg, var(--surface) 0%, var(--surface-soft) 100%); }
.profile-page > .profile-hero { margin-bottom: 24px; }
.profile-hero-body { display: flex; align-items: center; justify-content: space-between; gap: 40px; padding: 30px 32px; }
.profile-hero-main { display: flex; align-items: center; gap: 22px; min-width: 0; }
.profile-avatar { flex-basis: 84px; width: 84px; height: 84px; font-size: 28px; box-shadow: 0 0 0 8px var(--info-bg); }
.profile-identity-copy { min-width: 0; }
.profile-eyebrow { display: block; margin-bottom: 7px; color: var(--brand-blue-interaction); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.profile-identity-copy h2 { font-size: 24px; letter-spacing: -.025em; }
.profile-identity-copy p { overflow: hidden; margin: 6px 0 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-hero-facts { display: grid; grid-template-columns: repeat(2, minmax(145px, 1fr)); gap: 12px; min-width: 330px; }
.profile-fact { display: grid; gap: 6px; padding: 14px 15px; border: 1px solid var(--border-soft); border-radius: 10px; background: color-mix(in srgb, var(--surface) 72%, transparent); }
.profile-fact span, .profile-readonly-item small { color: var(--muted); font-size: 10px; }
.profile-fact strong { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .95fr); gap: 24px; align-items: start; }
.profile-personal-card { grid-column: 1; grid-row: 1; }
.profile-security-card { grid-column: 1; grid-row: 2; }
.profile-readonly-card { grid-column: 2; grid-row: 1 / span 2; }
.profile-personal-card .nexus-card-header { padding: 24px 28px 18px; }
.profile-personal-card .nexus-card-body { padding: 26px 28px 28px; }
.profile-personal-card .nexus-form { gap: 22px; }
.profile-personal-card .nexus-form-section { gap: 22px; padding-top: 0; border-top: 0; }
.profile-personal-card .nexus-form-actions { padding-top: 18px; }
.profile-readonly-card .nexus-card-header { padding: 22px 24px 16px; }
.profile-readonly-card .nexus-card-body { padding: 20px 24px 24px; }
.profile-readonly-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0; border-top: 0; }
.profile-readonly-item { min-height: 78px; padding: 14px 15px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-soft); }
.profile-readonly-item strong { display: block; margin-top: 2px; }
.profile-readonly-wide { grid-column: 1 / -1; }
.profile-security-card .nexus-card-header { align-items: center; padding: 22px 24px; border-bottom: 0; }
.profile-security-card .nexus-card-description { max-width: 34ch; }

  @media (max-width: 900px) {
    .profile-content-grid { grid-template-columns: minmax(0, 1fr); }
    .profile-personal-card,
    .profile-security-card,
    .profile-readonly-card { grid-column: auto; grid-row: auto; }
  }
@media (max-width: 700px) {
  .profile-page { gap: 18px !important; }
  .profile-page > .nexus-page-header { min-height: 0; padding-top: 0 !important; padding-bottom: 4px !important; }
  .profile-page > .nexus-page-header { margin-bottom: 14px !important; }
  .profile-page > .profile-hero { margin-bottom: 18px; }
  .profile-hero-body { align-items: stretch; flex-direction: column; gap: 22px; padding: 24px 20px 22px; }
  .profile-hero-main { gap: 18px; }
  .profile-avatar { flex-basis: 78px; width: 78px; height: 78px; font-size: 26px; }
  .profile-identity-copy h2 { font-size: 21px; }
  .profile-hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; gap: 12px; }
  .profile-content-grid { gap: 18px; }
  .profile-personal-card .nexus-card-header { padding: 20px 20px 16px; }
  .profile-personal-card .nexus-card-body { padding: 22px 20px 24px; }
  .profile-readonly-card .nexus-card-header { padding: 20px 20px 16px; }
  .profile-readonly-card .nexus-card-body { padding: 18px 20px 20px; }
  .profile-readonly-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-readonly-wide { grid-column: auto; }
  .profile-security-card .nexus-card-header { align-items: stretch; flex-direction: column; gap: 12px; padding: 16px; }
.profile-security-card .nexus-btn { align-self: flex-start; }
}


/* Logout confirmation: focused visual hierarchy without changing modal behavior. */
#logoutModal .nexus-modal {
  max-width: 448px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(17, 35, 64, .18), 0 6px 18px rgba(17, 35, 64, .1);
}
#logoutModal .nexus-modal-header {
  padding: 32px 36px 26px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}
#logoutModal .nexus-modal-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border: 1px solid color-mix(in srgb, var(--brand-red) 24%, var(--border));
  background: var(--surface);
  color: var(--brand-red);
  box-shadow: 0 0 0 7px var(--danger-bg), 0 8px 18px rgba(157, 42, 52, .12);
  font-size: 24px;
  animation: logout-icon-breathe 3.4s ease-in-out infinite;
}
#logoutModal .nexus-modal-title {
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.025em;
}
#logoutModal .nexus-modal-description {
  max-width: 100%;
  margin: 0 auto;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: nowrap;
}
#logoutModal .nexus-modal-footer {
  justify-content: center;
  gap: 12px;
  padding: 18px 28px 22px;
  background: var(--surface);
}
#logoutModal .nexus-modal-footer > .nexus-btn,
#logoutModal .nexus-modal-footer > form .nexus-btn {
  width: 136px;
  min-width: 136px;
  min-height: 40px;
  border-radius: 9px;
  font-weight: 700;
}
#logoutModal .nexus-modal-footer > form {
  display: flex;
  width: 136px;
}
#logoutModal .nexus-btn-secondary {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
}
#logoutModal .nexus-btn-secondary:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}
#logoutModal .nexus-btn-danger {
  border-color: color-mix(in srgb, var(--brand-red) 42%, var(--border));
  background: var(--brand-red);
  color: #fff;
  box-shadow: 0 4px 10px rgba(157, 42, 52, .16);
}
#logoutModal .nexus-btn-danger:hover {
  background: color-mix(in srgb, var(--brand-red) 86%, #000);
  border-color: color-mix(in srgb, var(--brand-red) 86%, #000);
  box-shadow: 0 6px 14px rgba(157, 42, 52, .22);
}
#logoutModal .nexus-btn-danger:focus-visible,
#logoutModal .nexus-btn-secondary:focus-visible {
  outline-offset: 3px;
}
[data-theme="dark"] #logoutModal .nexus-modal {
  box-shadow: 0 24px 60px rgba(0, 0, 0, .42), 0 6px 18px rgba(0, 0, 0, .24);
}
[data-theme="dark"] #logoutModal .nexus-modal-icon {
  background: var(--surface-elevated);
  box-shadow: 0 0 0 7px rgba(157, 42, 52, .2), 0 8px 18px rgba(0, 0, 0, .24);
}
[data-theme="dark"] #logoutModal .nexus-btn-danger {
  border-color: var(--brand-red) !important;
  background: var(--brand-red) !important;
  color: #fff !important;
}
@keyframes logout-icon-breathe {
  0%, 100% {
    box-shadow: 0 0 0 7px var(--danger-bg), 0 8px 20px rgba(157, 42, 52, .16);
  }
  50% {
    box-shadow: 0 0 0 12px var(--danger-bg), 0 11px 28px rgba(157, 42, 52, .24);
  }
}
@media (prefers-reduced-motion: reduce) {
  #logoutModal .nexus-modal-icon { animation: none; }
}
@media (max-width: 700px) {
  #logoutModal .nexus-modal-header { padding: 28px 24px 22px; }
  #logoutModal .nexus-modal-description { white-space: normal; }
  #logoutModal .nexus-modal-footer { padding: 16px 20px 20px; }
  #logoutModal .nexus-modal-footer > .nexus-btn,
  #logoutModal .nexus-modal-footer > form { flex: 1 1 140px; width: auto; }
  #logoutModal .nexus-modal-footer > form .nexus-btn { width: 100%; min-width: 0; }
}



/* Legacy domain pages keep their current markup while using the NEXUS dark palette. */
[data-theme="dark"] .page .panel-title {
  color: var(--text);
}
[data-theme="dark"] .page .input,
[data-theme="dark"] .page .select {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .page .input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}
[data-theme="dark"] .btn-secondary {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .btn-danger {
  background: var(--surface-elevated);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}
[data-theme="dark"] .btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface-elevated));
}

/* Shared content patterns for operational modules. */
.nexus-section-tabs { margin-bottom: var(--nexus-space-5); }
.nexus-page > .nexus-section-tabs { margin-bottom: 0; }
.nexus-filter-toolbar { padding: 16px 18px; }
.nexus-filter-toolbar .nexus-field { flex: 1 1 150px; }
.nexus-filter-toolbar .nexus-field--search { flex: 2 1 250px; }
.nexus-filter-toolbar .nexus-filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.nexus-filter-toolbar .nexus-filter-actions > * { min-height: 36px; }
.nexus-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.nexus-option-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
}
.nexus-option-card input[type="checkbox"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--brand-blue-interaction);
}
.nexus-option-card label {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.nexus-option-card p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}
.nexus-form input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font: 600 12px var(--font-ui);
  cursor: pointer;
}
.nexus-form input[type="file"]::file-selector-button:hover {
  border-color: var(--brand-blue-interaction);
  color: var(--brand-blue-interaction);
}

/* C12 recovery: restore the canonical global header cascade preserved before C13 cleanup. */
.nexus-page { gap: var(--nexus-space-5) !important; }
.nexus-page--vigilancia-primary { grid-template-columns: minmax(0, 1fr); }
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) {
  position: relative;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between;
  box-sizing: border-box !important;
  width: calc(100% - 146px + 7.96875vw) !important;
  height: 104px !important;
  min-height: 104px !important;
  min-width: 0;
  margin: 6px 0 0 calc(73px - 3.984375vw) !important;
  padding: 16px 0 16px 20px !important;
  border: 0 !important;
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header)::before {
  content: "";
  position: absolute;
  display: block !important;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--brand-red) 46%, transparent);
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) > div:first-child,
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) .nexus-module-header-main {
  flex: 1 1 auto;
  min-width: 0;
}
.nexus-page:not(.profile-page) .nexus-module-header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.nexus-page:not(.profile-page) .nexus-module-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 48%;
  min-width: 0;
  flex-wrap: wrap;
}
.nexus-page:not(.profile-page) :is(.nexus-page-title, .nexus-module-title, .nexus-page-header h1, .nexus-module-header h1, .page-header h1, .nx-page-header h1) {
  margin: 0 !important;
  color: var(--text) !important;
  font-family: var(--font-heading) !important;
  font-size: var(--nexus-page-title-size) !important;
  font-weight: var(--nexus-page-title-weight) !important;
  line-height: var(--nexus-page-title-line-height) !important;
  letter-spacing: var(--nexus-page-title-letter-spacing) !important;
  text-wrap: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) :is(.nexus-page-description, .nexus-module-description, p) {
  position: absolute !important;
  top: calc(53px + .546875vw) !important;
  left: 20px !important;
  right: 0 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  color: var(--muted) !important;
  font-family: var(--font-ui) !important;
  font-size: var(--nexus-page-description-size) !important;
  font-weight: var(--nexus-page-description-weight) !important;
  line-height: var(--nexus-page-description-line-height) !important;
  text-wrap: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) .nexus-page-actions {
  align-self: center;
  max-width: 48%;
  margin: 0;
}
.nexus-page:not(.profile-page) > .nexus-back-link {
  box-sizing: border-box;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  margin-left: calc(73px - 3.984375vw);
  padding-left: 20px;
}
@media (max-width: 700px) {
  .nexus-page { gap: var(--nexus-space-4) !important; }
  .nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) {
    align-items: stretch !important;
    flex-direction: column;
    gap: 12px;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 0 12px !important;
    padding: 14px 0 14px 16px !important;
  }
  .nexus-page:not(.profile-page) > .nexus-back-link {
    margin-left: 0;
    padding-left: 16px;
  }
  .nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header)::before {
    top: 0;
    bottom: 0;
    width: 4px;
  }
  .nexus-page:not(.profile-page) .nexus-module-header-main {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .nexus-page:not(.profile-page) .nexus-module-actions,
  .nexus-page:not(.profile-page) .nexus-page-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }
  .nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) :is(.nexus-page-description, .nexus-module-description, p) {
    position: static !important;
    width: 100% !important;
    margin-top: 8px !important;
  }
  .nexus-page:not(.profile-page) :is(.nexus-page-title, .nexus-module-title, .nexus-page-header h1, .nexus-module-header h1, .page-header h1, .nx-page-header h1) {
    font-size: clamp(24px, 6vw, 28px) !important;
    text-wrap: balance;
    white-space: normal;
  }
}
/* C13: canonical card system. Panels and table surfaces retain their structural roles. */
.nexus-card {
  color: var(--text);
  background: var(--nexus-card-bg);
  border-color: var(--nexus-card-border);
  border-radius: var(--nexus-card-radius);
  box-shadow: var(--nexus-card-shadow);
  font-family: var(--font-ui);
  transition: box-shadow var(--motion-normal) ease, transform var(--motion-normal) ease;
}
.nexus-card--summary { min-width: 0; }
.nexus-card--interactive { cursor: pointer; }
.nexus-card--interactive:hover,
.nexus-action-card.nexus-card--interactive:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(34, 68, 120, .10), 0 3px 8px rgba(34, 68, 120, .045);
}
.nexus-card--interactive:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.nexus-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--nexus-card-gap);
  min-width: 0;
  margin-bottom: var(--nexus-space-6);
}
.nexus-card-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nexus-card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nexus-card--metric {
  --nexus-card-tone: var(--nexus-card-neutral);
  display: flex;
  align-items: center;
  gap: var(--nexus-card-gap);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: var(--nexus-card-metric-height);
  min-height: var(--nexus-card-metric-height);
  padding: var(--nexus-card-padding);
  overflow: hidden;
  border: 1px solid var(--nexus-card-border);
  border-radius: var(--nexus-card-radius);
  background: var(--nexus-card-bg);
  box-shadow: var(--nexus-card-shadow);
  font-family: var(--font-ui);
}
.nexus-card--metric[data-tone="primary"] { --nexus-card-tone: var(--nexus-card-primary); }
.nexus-card--metric[data-tone="success"] { --nexus-card-tone: var(--nexus-card-success); }
.nexus-card--metric[data-tone="warning"] { --nexus-card-tone: var(--nexus-card-warning); }
.nexus-card--metric[data-tone="danger"] { --nexus-card-tone: var(--nexus-card-danger); }
.nexus-card--metric[data-tone="info"] { --nexus-card-tone: var(--nexus-card-info); }
.nexus-card--metric[data-tone="neutral"] { --nexus-card-tone: var(--nexus-card-neutral); }
.nexus-card--metric[data-tone="purple"] { --nexus-card-tone: var(--nexus-card-purple); }
.nexus-card-icon {
  display: grid;
  flex: 0 0 var(--nexus-card-icon-size);
  place-items: center;
  width: var(--nexus-card-icon-size);
  height: var(--nexus-card-icon-size);
  border-radius: 50%;
  background: color-mix(in srgb, var(--nexus-card-tone, var(--nexus-card-primary)) 12%, var(--nexus-card-bg));
  color: var(--nexus-card-tone, var(--nexus-card-primary));
  font-size: 18px;
}
.nexus-card-divider { flex: 0 0 1px; width: 1px; height: var(--nexus-card-divider-height); background: var(--nexus-card-border); }
.nexus-card-metric { display: grid; flex: 1 1 auto; min-width: 0; gap: 3px; align-content: center; }
.nexus-card-value {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 31px;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--nexus-card-tone, var(--text));
  font-size: var(--nexus-card-value-size);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1.05;
}
.nexus-card-value--compact { font-size: clamp(16px, 1.35vw, 21px); letter-spacing: -.025em; }
.nexus-card-label {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--nexus-card-label-size);
  font-weight: 650;
  letter-spacing: .035em;
  line-height: 1.35;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.nexus-card-description { display: block; min-width: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.nexus-card-description a { color: var(--nexus-card-tone); font-weight: 700; text-decoration: none; }
.nexus-card-description a:hover { text-decoration: underline; }
.nexus-empty-state { font-family: var(--font-ui); }
[data-theme="dark"] .nexus-card--interactive:hover,
[data-theme="dark"] .nexus-action-card.nexus-card--interactive:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, .32), 0 3px 8px rgba(0, 0, 0, .20);
}
@media (max-width: 1439px) {
  .nexus-card-grid--4, .nexus-card-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .nexus-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .nexus-card--metric { gap: 10px; padding: 14px 12px; }
  .nexus-card-icon { --nexus-card-icon-size: 38px; font-size: 16px; }
  .nexus-card-value { font-size: 24px; }
  .nexus-card-value--compact { font-size: 16px; }
  .nexus-card-label { font-size: 10px; }
}
@media (max-width: 430px) {
  .nexus-card-grid, .nexus-card-grid--3, .nexus-card-grid--4 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .nexus-card, .nexus-card--interactive { transition: none; } }

/* C13.2: every primary page description stays on one line at every breakpoint. */
:is(.nexus-page-header, .nexus-module-header, .nx-page-header, .page-header, .home-header, .nexus-page-intro) > div:first-child,
:is(.nexus-page-header, .nexus-module-header, .nx-page-header, .page-header, .home-header, .nexus-page-intro) .nexus-module-header-main {
  min-width: 0;
  max-width: 100%;
}
:is(.nexus-page-header, .nexus-module-header, .nx-page-header, .page-header, .home-header, .nexus-page-intro) :is(.nexus-page-description, .nexus-module-description, .page-lead, .page-sub, p) {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nexus-module-header, .page-header, .nx-page-header) :is(.nexus-page-description, .nexus-module-description, p) {
  min-width: 0 !important;
  max-width: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Summary content layout complements metric cards without restyling panels. */
.nexus-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--nexus-space-5);
  min-width: 0;
}
.nexus-summary-list { display: grid; gap: 2px; }
.nexus-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 13px;
}
.nexus-summary-row:last-child { border-bottom: 0; }
@media (max-width: 700px) {
  .nexus-section-grid { grid-template-columns: minmax(0, 1fr); }
}

/* C13.3: one quiet return action and a content-driven header when it is present. */
:is(.nexus-back-link, .workspace a:has(.fa-arrow-left)) {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 8px;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  height: auto !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--link) !important;
  font: 700 13px/1.35 var(--font-ui) !important;
  text-decoration: none !important;
}
:is(.nexus-back-link, .workspace a:has(.fa-arrow-left)):hover {
  color: var(--link) !important;
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nx-page-header, .page-header):has(.nexus-back-link, .fa-arrow-left),
:is(.nexus-page-header, .nx-page-header, .page-header):has(.nexus-back-link, .fa-arrow-left) {
  height: auto !important;
  min-height: 104px !important;
}
.nexus-page:not(.profile-page) > :is(.nexus-page-header, .nx-page-header, .page-header):has(.nexus-back-link, .fa-arrow-left)
  :is(.nexus-page-description, .nexus-module-description, .page-lead, .page-sub, p),
:is(.nexus-page-header, .nx-page-header, .page-header):has(.nexus-back-link, .fa-arrow-left)
  :is(.nexus-page-description, .nexus-module-description, .page-lead, .page-sub, p) {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  margin-top: 8px !important;
}
/* Legacy headers put their sole return link in the action column. */
:is(.nexus-page-header, .nx-page-header, .page-header):has(> div:last-child > a:only-child .fa-arrow-left),
:is(.nexus-page-header, .nx-page-header, .page-header):has(> div:last-child > a.nexus-back-link:only-child) {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0 !important;
}
:is(.nexus-page-header, .nx-page-header, .page-header):has(> div:last-child > a:only-child .fa-arrow-left) > div:last-child,
:is(.nexus-page-header, .nx-page-header, .page-header):has(> div:last-child > a.nexus-back-link:only-child) > div:last-child {
  order: -1;
  align-self: flex-start;
}

/* Reusable form-section layout for longer operational flows. */
.nexus-form-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 20px;
  min-width: 0;
}
.nexus-form-panel {
  width: 100%;
  max-width: none;
  min-width: 0;
}
.nexus-form-panel > .nexus-card-header {
  min-height: 64px;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.nexus-form-panel .nexus-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nexus-form-panel .nexus-card-title i { color: var(--brand-blue-interaction); }
.nexus-form-panel > .nexus-card-body {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
}
.nexus-form-panel .nexus-form-grid { gap: 16px; min-width: 0; }
.nexus-form-panel .nexus-form-grid--document {
  grid-template-columns: minmax(150px, .85fr) minmax(0, 1.15fr);
}
.nexus-form-panel .nexus-form-grid > div,
.nexus-form-panel .nexus-card-body > div:not(.nexus-form-grid):not(.nexus-inline-notice) {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}
.nexus-form-panel .label {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
.nexus-form-panel :is(input, select, textarea) { min-width: 0; }
.nexus-form-panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.nexus-inline-notice {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
}
.nexus-inline-notice--info { border-color: var(--border-soft); }
.nexus-inline-notice-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.nexus-inline-notice-title {
  color: var(--brand-blue-interaction);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.nexus-inline-notice-emphasis { margin-top: 4px; font-size: 14px; font-weight: 700; }
.nexus-inline-notice-help { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.nexus-inline-notice--info .nexus-badge {
  background: color-mix(in srgb, var(--brand-blue-interaction) 12%, transparent);
  color: var(--brand-blue-interaction);
}
.nexus-inline-notice-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.nexus-inline-notice-choice + .nexus-inline-notice-help { margin-left: 24px; }
.nexus-form-actions--footer { justify-content: flex-end; }
.nexus-form-card {
  width: 100%;
  max-width: 960px;
  min-width: 0;
  margin: 0 auto;
}
.nexus-form-card--wide { max-width: 1120px; }
.nexus-form-card--compact { max-width: 800px; }
.nexus-form-card > form {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.nexus-form-card [style*="grid-template-columns"] > div {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}
.nexus-form-card :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 1000px) {
  .nexus-form-layout { grid-template-columns: minmax(0, 1fr); }
  .nexus-form-card [style*="grid-template-columns"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 700px) {
  .nexus-form-panel .nexus-form-grid--document { grid-template-columns: minmax(0, 1fr); }
  .nexus-form-panel > .nexus-card-body { padding: 16px; }
  .nexus-form-actions--footer > :is(a, button) { flex: 1 1 100%; justify-content: center; }
  .nexus-form-card [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

.nexus-form-card--full { max-width: none; margin-inline: 0; }
.nexus-form-grid > * { min-width: 0; }
.nexus-form-grid :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.nexus-form-grid--two-one { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.nexus-form-grid--one { grid-template-columns: minmax(0, 1fr); }
.nexus-form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nexus-form-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) {
  .nexus-form-grid--three,
  .nexus-form-grid--four,
  .nexus-form-grid--two-one { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .nexus-form-grid--three,
  .nexus-form-grid--four,
  .nexus-form-grid--two-one { grid-template-columns: minmax(0, 1fr); }
}

/* Compact listing filters remain on one desktop row when the workspace allows it. */
.nexus-list-toolbar > .nexus-toolbar-filters--listing { flex-wrap: nowrap; }
.nexus-list-toolbar > .nexus-toolbar-filters--listing > input[type="text"] {
  flex: 1 1 360px;
  width: auto;
  min-width: 240px;
  max-width: none;
}
.nexus-list-toolbar > .nexus-toolbar-filters--listing > select {
  flex: 0 1 220px;
  width: auto;
  min-width: 170px;
  max-width: 260px;
}
.nexus-list-toolbar > .nexus-toolbar-filters--listing > :is(button, a) {
  flex: 0 0 auto;
  white-space: nowrap;
}
.nexus-module-heading { flex: 1 1 auto; min-width: 0; }
.nexus-module-heading > .nexus-back-link { margin-bottom: 8px !important; }
.nexus-page:not(.profile-page) > .nexus-module-header:has(.nexus-module-heading > .nexus-back-link) {
  height: auto !important;
  min-height: 0 !important;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}
.nexus-page:not(.profile-page) > .nexus-module-header:has(.nexus-module-heading > .nexus-back-link) > .nexus-module-description {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  margin: 0 !important;
}
@media (max-width: 1100px) {
  .nexus-list-toolbar > .nexus-toolbar-filters--listing { flex-wrap: wrap; }
  .nexus-list-toolbar > .nexus-toolbar-filters--listing > input[type="text"] { flex-basis: 260px; }
  .nexus-module-heading { width: 100%; }
}

/* Encuesta question deletion touch target */
.page-encuesta-preguntas .encuesta-pregunta-delete-btn {
  min-height: 44px;
}

/* I2-B responsive containment: allow page content to shrink without hiding data. */
.nexus-page,
.nexus-page > *,
.nexus-page-header,
.nexus-page-header > *,
.nexus-card,
.nx-card,
.panel,
.card {
  min-width: 0;
  box-sizing: border-box;
}
.nexus-page-header { flex-wrap: wrap; }
@media (max-width: 700px) {
  .nexus-page.page-reunion-detail > .nexus-page-header { flex-wrap: nowrap; }
  .nexus-page.page-reunion-detail > .nexus-page-header .nexus-page-actions {
    align-self: stretch;
    flex: 0 1 auto;
    width: 100%;
    max-width: 100%;
  }
}
@media (min-width: 1200px) {
  .nexus-page.page-reunion-detail > .nexus-page-header > .nexus-page-actions {
    max-width: none;
  }
}
.nexus-page-title,
.nexus-page-header h1 {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.nexus-page-header h1 { flex-wrap: wrap; }
.nexus-table-wrap {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto !important;
}
.nexus-table-wrap.nexus-table-scroll-y { overflow-y: auto !important; }
.nexus-page :is(input, select, textarea) { box-sizing: border-box; max-width: 100%; }

.page-reunion-detail .reunion-attendees-heading {
  flex-wrap: wrap;
  gap: 8px 16px;
  min-width: 0;
  max-width: 100%;
}
.page-reunion-detail .reunion-attendance-summary {
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

[data-theme="dark"] .page-ti-edit :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  background: var(--surface-input);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .page-ti-edit :is(input, textarea)::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}
[data-theme="dark"] .btn-secondary {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .btn-danger {
  background: var(--surface-elevated);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}
[data-theme="dark"] .btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface-elevated));
}

/* ==========================================================================
   DEC-UI-005: Tarjetas Informativas Neutras y Tablas Operativas Canónicas
   ========================================================================== */

.nexus-info-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-soft, #edf1f5);
  border-radius: 10px;
  background: var(--surface-soft, #f8fafc);
  color: var(--text, #1f2937);
  font-size: 13px;
  line-height: 1.5;
}

.nexus-info-card > i {
  color: var(--brand-blue-interaction, #1e5aa8);
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.catalogo-table-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.catalogo-table-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px;
}

.catalogo-table-heading h2 {
  margin: 0;
  color: var(--text, #1f2937);
  font-size: 16px;
  font-weight: 700;
}

.catalogo-table-heading p {
  margin: 4px 0 0;
  color: var(--muted, #667085);
  font-size: 12px;
}

.catalogo-table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-top: 1px solid var(--border-soft, #edf1f5);
}

/* ==========================================================================
   DEC-UI-006: Normalización Global de Notas Discretas Junto al Buscador
   ========================================================================== */

.nexus-search-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  max-width: 100%;
}

.nexus-search-note > i {
  color: var(--brand-blue-interaction, #1e5aa8);
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nexus-search-note strong {
  color: var(--text, #1f2937);
  font-weight: 500;
}

.nexus-search-note--inline {
  align-self: center;
  margin: 0 0 0 auto;
}

.nexus-search-note--block {
  display: flex;
}

.nexus-toolbar-note {
  grid-column: 1 / -1;
  width: auto;
  align-self: flex-start;
  margin-top: 6px;
}

/* ==========================================================================
   DEC-UI-006: Tooltip Informativo Canónico Junto a Títulos (.nexus-title-info)
   ========================================================================== */

.nexus-title-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 8px;
}

.nexus-title-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--brand-blue-interaction, #2563eb);
  cursor: pointer;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  transition: color var(--motion-fast, 120ms ease), background-color var(--motion-fast, 120ms ease), transform var(--motion-fast, 120ms ease);
}

.nexus-title-info-btn:hover {
  color: var(--brand-blue-interaction-hover, #1d4ed8);
  background: var(--surface-soft, rgba(37, 99, 235, 0.08));
}

.nexus-title-info-btn:focus-visible {
  outline: 2px solid var(--brand-blue-interaction, #2563eb);
  outline-offset: 2px;
}

.nexus-title-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  min-width: 260px;
  padding: 10px 14px;
  background: #1e293b; /* gris azulado oscuro institucional */
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.35), 0 8px 10px -6px rgba(15, 23, 42, 0.25);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  transition: opacity var(--motion-fast, 120ms ease), transform var(--motion-fast, 120ms ease), visibility var(--motion-fast, 120ms ease);
}

/* Flecha apuntando al icono */
.nexus-title-tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #1e293b transparent;
}

/* Modificadores de alineación horizontal para prevenir cortes */
.nexus-title-tooltip--align-left {
  left: 0;
  transform: translateX(0) translateY(4px);
}
.nexus-title-tooltip--align-left::before {
  left: 11px;
  transform: translateX(0);
}

.nexus-title-tooltip--align-right {
  left: auto;
  right: 0;
  transform: translateX(0) translateY(4px);
}
.nexus-title-tooltip--align-right::before {
  left: auto;
  right: 11px;
  transform: translateX(0);
}

/* Estado activo por hover, foco o clase .is-active */
.nexus-title-info:hover .nexus-title-tooltip,
.nexus-title-info:focus-within .nexus-title-tooltip,
.nexus-title-tooltip.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nexus-title-info:hover .nexus-title-tooltip--align-left,
.nexus-title-info:focus-within .nexus-title-tooltip--align-left,
.nexus-title-tooltip--align-left.is-active {
  transform: translateX(0) translateY(0);
}

.nexus-title-info:hover .nexus-title-tooltip--align-right,
.nexus-title-info:focus-within .nexus-title-tooltip--align-right,
.nexus-title-tooltip--align-right.is-active {
  transform: translateX(0) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .nexus-title-info-btn,
  .nexus-title-tooltip {
    transition: none !important;
  }
}
