  <style>
    /* Scope to login-screen and tenant-selection-screen */
    #login-screen,
    #tenant-selection-screen {
      background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #0a0e1a 100%);
      position: relative;
      overflow: hidden;
      perspective: 1000px;
    }

    #login-screen .background-orb,
    #tenant-selection-screen .background-orb {
      position: fixed;
      width: 600px;
      height: 600px;
      border-radius: 50%;
      background: radial-gradient(circle at 30% 30%, rgba(59, 130, 246, .8) 0%, rgba(29, 78, 216, .6) 25%, rgba(30, 58, 138, .4) 50%, rgba(15, 23, 42, .2) 75%, transparent 100%);
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: orbPulse 8s ease-in-out infinite;
      filter: blur(1px);
      z-index: 1;
    }

    #login-screen .orbital-ring,
    #tenant-selection-screen .orbital-ring {
      position: fixed;
      border: 2px solid rgba(59, 130, 246, .3);
      border-radius: 50%;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      animation: rotate 25s linear infinite;
      z-index: 2;
    }

    #login-screen .orbital-ring.r1,
    #tenant-selection-screen .orbital-ring.r1 {
      width: 400px;
      height: 400px;
      animation-duration: 25s;
    }

    #login-screen .orbital-ring.r2,
    #tenant-selection-screen .orbital-ring.r2 {
      width: 500px;
      height: 500px;
      animation-duration: 30s;
      animation-direction: reverse;
    }

    #login-screen .orbital-ring.r3,
    #tenant-selection-screen .orbital-ring.r3 {
      width: 700px;
      height: 700px;
      animation-duration: 40s;
      border-color: rgba(29, 78, 216, .2);
    }

    @keyframes rotate {
      from {
        transform: translate(-50%, -50%) rotate(0deg);
      }

      to {
        transform: translate(-50%, -50%) rotate(360deg);
      }
    }

    @keyframes orbPulse {

      0%,
      100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: .8
      }

      50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1
      }
    }

    @keyframes cyberFloat {
      0% {
        transform: translateY(100vh) translateX(0) rotate(0);
        opacity: 0
      }

      10% {
        opacity: 1
      }

      90% {
        opacity: 1
      }

      100% {
        transform: translateY(-20vh) translateX(20px) rotate(360deg);
        opacity: 0
      }
    }

    /* CRITICAL LOADER STYLES */
    #global-loader {
      position: fixed;
      inset: 0;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background-color: white;
      transition: opacity 0.5s ease;
    }

    #global-loader.opacity-0 {
      pointer-events: none;
    }

    .dark #global-loader {
      background-color: #0f172a;
    }

    #global-loader .loader-blur {
      position: absolute;
      inset: 0;
      background-color: rgba(59, 130, 246, 0.2);
      filter: blur(64px);
      border-radius: 9999px;
      transform: scale(1.5);
      animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    #global-loader img {
      width: 8rem;
      height: 8rem;
      position: relative;
      z-index: 10;
      filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15));
    }

    #global-loader .loader-text {
      text-transform: uppercase;
      letter-spacing: 0.1em;
      font-weight: 900;
      font-size: 1.25rem;
      color: #111827;
      animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    .dark #global-loader .loader-text {
      color: #e5e7eb;
    }

    #global-loader .dot-container {
      display: flex;
      gap: 0.375rem;
    }

    #global-loader .dot {
      width: 0.5rem;
      height: 0.5rem;
      border-radius: 9999px;
      animation: bounce 1s infinite;
    }

    #global-loader .dot:nth-child(1) {
      background-color: #2563eb;
      animation-delay: -0.3s;
    }

    #global-loader .dot:nth-child(2) {
      background-color: #3b82f6;
      animation-delay: -0.15s;
    }

    #global-loader .dot:nth-child(3) {
      background-color: #60a5fa;
    }

    @keyframes pulse {

      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: .5;
      }
    }

    @keyframes bounce {

      0%,
      100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
      }

      50% {
        transform: none;
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
      }
    }

    /* Tilt 3D base perspective - applied above */

    #login-screen .login-container,
    #tenant-selection-screen #tenant-tilt {
      background: rgba(15, 23, 42, .95);
      backdrop-filter: blur(25px);
      border-radius: 20px;
      padding: 3rem;
      width: 420px;
      max-width: 90vw;
      box-shadow: 0 25px 50px rgba(0, 0, 0, .5), 0 0 50px rgba(59, 130, 246, .1), inset 0 1px 0 rgba(59, 130, 246, .2);
      position: relative;
      z-index: 10;
      border: 1px solid rgba(59, 130, 246, .3);
      animation: containerEntry 1s cubic-bezier(.16, 1, .3, 1);
      transform-style: preserve-3d;
      will-change: transform;
      transition: transform 120ms ease-out;
    }

    /* Cursor glare overlay */
    #login-screen .login-container .glare,
    #tenant-selection-screen .glare {
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
      z-index: 11;
      mix-blend-mode: screen;
      opacity: var(--gop, .35);
      background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .16), rgba(59, 130, 246, .12) 30%, transparent 60%);
    }

    @keyframes containerEntry {
      0% {
        opacity: 0;
        transform: translateY(50px) scale(.9);
        filter: blur(10px);
      }

      100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
      }
    }

    #login-screen .login-logo,
    #tenant-selection-screen .login-logo {
      display: block;
      margin: 0 auto 0rem auto;
      height: 150px;
      width: auto;
      filter: drop-shadow(0 0 12px rgba(59, 130, 246, .35));
    }

    #login-screen .login-title,
    #tenant-selection-screen .login-title {
      font-size: 2.2rem;
      font-weight: 200;
      color: #e2e8f0;
      margin-bottom: .5rem;
      animation: titleGlow 2s ease-in-out infinite alternate;
      text-align: center;
      text-shadow: 0 0 20px rgba(59, 130, 246, .3);
    }

    /* Ajuste específico para título largo en selección de empresa */
    #tenant-selection-screen .login-title {
      font-size: 1.75rem;
    }

    @keyframes titleGlow {
      0% {
        text-shadow: 0 0 20px rgba(59, 130, 246, .3);
      }

      100% {
        text-shadow: 0 0 30px rgba(59, 130, 246, .6);
      }
    }

    #login-screen .login-subtitle,
    #tenant-selection-screen .login-subtitle {
      color: #94a3b8;
      font-size: .95rem;
      text-align: center;
      margin-bottom: 2rem;
      font-weight: 300;
    }

    #login-screen .form-group,
    #tenant-selection-screen .form-group {
      margin-bottom: 1.25rem;
      position: relative;
    }

    #login-screen .form-input-neo,
    #tenant-selection-screen .form-input-neo {
      width: 100%;
      padding: 1rem;
      font-size: 1rem;
      border: 2px solid rgba(59, 130, 246, .3);
      border-radius: 10px;
      background: rgba(30, 58, 138, .1);
      color: #e2e8f0;
      outline: none;
      transition: all .3s;
      backdrop-filter: blur(10px);
    }

    #login-screen .form-input-neo::placeholder,
    #tenant-selection-screen .form-input-neo::placeholder {
      color: #64748b;
      transition: all .3s;
    }

    #login-screen .form-input-neo:focus,
    #tenant-selection-screen .form-input-neo:focus {
      border-color: #3b82f6;
      box-shadow: 0 0 20px rgba(59, 130, 246, .3), inset 0 0 20px rgba(59, 130, 246, .05);
      background: rgba(30, 58, 138, .15);
      transform: translateY(-2px);
    }

    #login-screen .login-button-neo,
    #tenant-selection-screen .login-button-neo {
      width: 100%;
      padding: 1.1rem;
      font-size: 1.05rem;
      font-weight: 500;
      color: #fff;
      background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #1d4ed8 100%);
      border: 2px solid rgba(59, 130, 246, .5);
      border-radius: 12px;
      cursor: pointer;
      margin-top: 1.25rem;
      position: relative;
      overflow: hidden;
      transition: all .3s;
      text-transform: uppercase;
      letter-spacing: 1px;
      box-shadow: 0 10px 30px rgba(59, 130, 246, .3);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: .5rem;
    }

    #login-screen .login-button-neo:hover,
    #tenant-selection-screen .login-button-neo:hover {
      transform: translateY(-3px);
      box-shadow: 0 15px 40px rgba(59, 130, 246, .4), 0 0 30px rgba(59, 130, 246, .3);
      border-color: #60a5fa;
    }

    #login-screen .login-button-neo:active,
    #tenant-selection-screen .login-button-neo:active {
      transform: translateY(-1px);
    }

    #login-screen .login-button-neo::before,
    #tenant-selection-screen .login-button-neo::before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .4), transparent);
      transition: left .6s;
    }

    #login-screen .login-button-neo:hover::before,
    #tenant-selection-screen .login-button-neo:hover::before {
      left: 100%;
    }

    #login-screen .login-links {
      text-align: center;
      margin-top: 1rem;
    }

    #login-screen .login-links a {
      color: #60a5fa;
      text-decoration: none;
      font-size: .9rem;
      transition: all .3s;
      position: relative;
    }

    #login-screen .login-links a:hover {
      color: #93c5fd;
      text-shadow: 0 0 10px rgba(59, 130, 246, .5);
    }

    #login-screen .login-links a::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: 0;
      width: 0;
      height: 1px;
      background: linear-gradient(90deg, #3b82f6, #60a5fa);
      transition: width .3s;
    }

    #login-screen .login-links a:hover::after {
      width: 100%;
    }

    #login-screen .spinner {
      width: 18px;
      height: 18px;
    }

    #login-screen .spinner .path {
      stroke: #fff;
      stroke-linecap: round;
      animation: dash 1.5s ease-in-out infinite;
    }

    @keyframes dash {
      0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
      }

      50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
      }

      100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
      }
    }

    /* Neo Sidebar Redesign (inspirado en dynamic_vertical_menu) */
    #sidebar.neo-sidebar {
      /* Fondo del menú con tono exacto solicitado */
      background: var(--sidebar-bg);
      box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
      transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1), transform 0.3s ease;
      overflow: hidden;
      backdrop-filter: blur(20px);
    }

    #sidebar.neo-sidebar::before {
      content: '';
      position: absolute;
      inset: 0;
      /* Overlay acorde al tono #111827 */
      background: linear-gradient(180deg, rgba(17, 24, 39, 0.0) 0%, rgba(17, 24, 39, 0.16) 50%, rgba(17, 24, 39, 0.28) 100%);
      pointer-events: none;
    }

    #sidebar.neo-sidebar .sidebar-header {
      height: 70px;
      display: flex;
      align-items: center;
      padding: 0 20px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      background: rgba(255, 255, 255, 0.05);
      backdrop-filter: blur(10px);
      position: relative;
    }

    #sidebar.neo-sidebar .sidebar-header::after {
      content: '';
      position: absolute;
      left: 20px;
      right: 20px;
      bottom: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, #3b82f6, transparent);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    #sidebar.neo-sidebar:not(.collapsed) .sidebar-header::after {
      opacity: 1;
    }

    #sidebar.neo-sidebar .logo {
      width: 32px;
      height: 32px;
      border-radius: 10px;
      flex-shrink: 0;
      position: relative;
      overflow: hidden;
      box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    }

    #sidebar.neo-sidebar .logo-text {
      margin-left: 15px;
      color: #ffffff;
      font-weight: 600;
      font-size: 17px;
      white-space: nowrap;
      letter-spacing: -0.025em;
      opacity: 1;
      transform: translateX(0);
      transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0.1s;
    }

    #sidebar.neo-sidebar.collapsed .logo-text {
      opacity: 0;
      transform: translateX(-10px);
      pointer-events: none;
    }

    /* Secciones y títulos */
    #sidebar.neo-sidebar nav {
      padding: 25px 0;
    }

    #sidebar.neo-sidebar nav h4 {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: rgba(255, 255, 255, 0.85);
      margin: 0 20px 15px;
      opacity: 1;
      /* mayor legibilidad */
      transition: opacity 0.3s ease 0.2s;
    }

    #sidebar.neo-sidebar.collapsed nav h4 {
      opacity: 0;
      height: 0;
      margin: 0;
      overflow: hidden;
    }

    /* Botones del menú */
    #sidebar.neo-sidebar .nav-btn {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 14px 20px;
      margin-right: 8px;
      color: rgba(255, 255, 255, 0.8);
      border-radius: 0 25px 25px 0;
      position: relative;
      overflow: hidden;
      /* texto ligeramente más claro */
      transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
      background: transparent;
      border: none;
      width: calc(100% - 8px);
    }

    #sidebar.neo-sidebar .nav-btn i {
      width: 22px;
      text-align: center;
      transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
      color: rgba(255, 255, 255, 0.9);
    }

    #sidebar.neo-sidebar .nav-btn:hover i {
      transform: scale(1.1);
      filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.35));
      color: #e5efff;
    }

    #sidebar.neo-sidebar .nav-btn span {
      margin-left: 18px;
      white-space: nowrap;
      font-weight: 500;
      font-size: 14px;
      letter-spacing: -0.01em;
      opacity: 1;
      transform: translateX(0);
      transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    }

    #sidebar.neo-sidebar .nav-btn::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(37, 99, 235, 0.22));
      /* contraste mejorado para #111827 */
      transform: translateX(-100%);
      transition: transform 0.3s ease;
      will-change: transform;
    }

    #sidebar.neo-sidebar .nav-btn:hover::before {
      transform: translateX(0);
    }

    #sidebar.neo-sidebar .nav-btn:hover {
      color: #ffffff;
      background: rgba(255, 255, 255, 0.10);
      transform: translateX(5px);
    }

    #sidebar.neo-sidebar .nav-btn.active {
      background: linear-gradient(90deg, rgba(255, 255, 255, 0.10), rgba(37, 99, 235, 0.28));
      color: #ffffff;
      box-shadow: 0 4px 24px rgba(37, 99, 235, 0.35);
    }

    #sidebar.neo-sidebar .nav-btn.active::after {
      content: '';
      position: absolute;
      right: 0;
      top: 20%;
      bottom: 20%;
      width: 3px;
      background: linear-gradient(180deg, #2563eb, #06b6d4);
      border-radius: 2px;
      box-shadow: 0 0 10px #2563eb;
    }

    /* Estados colapsado / expandido */
    #sidebar.neo-sidebar.collapsed {
      width: 4.5rem;
    }

    #sidebar.neo-sidebar:not(.collapsed) {
      width: 16rem;
    }

    #sidebar.neo-sidebar.collapsed .nav-btn {
      justify-content: center;
      padding: 14px;
    }

    /* Rehabilitar el span en colapsado (anula regla previa que lo ocultaba) para permitir animación */
    #sidebar.neo-sidebar.collapsed .nav-btn span {
      opacity: 0;
      transform: translateX(-10px);
      margin-left: 0;
      width: 0;
      overflow: hidden;
    }

    /* Ajustes del footer del usuario dentro del sidebar */
    #sidebar.neo-sidebar #user-info {
      background: rgba(0, 0, 0, 0.2);
      border-radius: 10px;
    }

    /* Mostrar solo el avatar (ocultar nombre y rol) SOLO cuando está colapsado */
    #sidebar.neo-sidebar.collapsed #user-info #user-info-name,
    #sidebar.neo-sidebar.collapsed #user-info #user-info-role {
      display: none;
    }

    #sidebar.neo-sidebar.collapsed #user-info .flex {
      justify-content: center;
      gap: 0;
    }

    #sidebar.neo-sidebar.collapsed #user-info #user-info-avatar {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 9999px;
      overflow: hidden;
    }

    /* Tooltip en modo colapsado - botones */
    #sidebar.neo-sidebar.collapsed .nav-btn::after {
      content: attr(data-tooltip);
      position: absolute;
      left: 75px;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(15, 23, 42, 0.95);
      color: #fff;
      padding: 8px 12px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s ease;
      z-index: 1001;
      border: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    #sidebar.neo-sidebar.collapsed .nav-btn:hover::after {
      opacity: 1;
      visibility: visible;
      left: 80px;
    }

    /* Tooltip en modo colapsado - avatar usuario */
    #sidebar.neo-sidebar.collapsed #user-info::after {
      content: attr(data-tooltip);
      position: absolute;
      left: 75px;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(15, 23, 42, 0.95);
      color: #fff;
      padding: 8px 12px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s ease;
      z-index: 1001;
      border: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    #sidebar.neo-sidebar.collapsed #user-info:hover::after {
      opacity: 1;
      visibility: visible;
      left: 80px;
    }

    /* Forzar que reglas generales de colapso no oculten span en modo neo (excepto textos de botones) */
    #sidebar.neo-sidebar.collapsed nav h4,
    #sidebar.neo-sidebar.collapsed .p-4 span.font-bold {
      display: inline !important;
    }

    /* Submenús animados (accordion) */
    #sidebar.neo-sidebar .submenu {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.35s ease, opacity 0.25s ease;
      opacity: 0;
    }

    #sidebar.neo-sidebar .submenu.open {
      opacity: 1;
    }

    #sidebar.neo-sidebar .submenu-btn {
      position: relative;
    }

    #sidebar.neo-sidebar .submenu-btn .chev {
      margin-left: auto;
      transition: transform 0.25s ease;
      opacity: .9;
    }

    #sidebar.neo-sidebar .submenu-btn[aria-expanded="true"] .chev {
      transform: rotate(90deg);
    }

    #sidebar.neo-sidebar .submenu .nav-btn {
      padding-left: 54px;
    }

    /* Ocultar chevron y centrar iconos cuando está colapsado */
    #sidebar.neo-sidebar.collapsed .submenu-btn .chev {
      display: none;
    }

    #sidebar.neo-sidebar.collapsed .nav-btn {
      justify-content: center;
      margin-right: 0;
      width: 100%;
      gap: 0;
      padding: 14px 0;
    }

    #sidebar.neo-sidebar.collapsed .nav-btn i {
      margin: 0 !important;
      width: 24px;
      text-align: center;
    }

    #sidebar.neo-sidebar.collapsed .nav-btn span {
      display: none;
    }

    #sidebar.neo-sidebar.collapsed .submenu .nav-btn {
      padding-left: 0;
    }

    #sidebar.neo-sidebar.collapsed .nav-btn:hover {
      transform: none;
    }

    /* Evitar desplazamiento horizontal */
    #sidebar.neo-sidebar,
    #sidebar.neo-sidebar nav,
    #sidebar.neo-sidebar .submenu,
    #sidebar.neo-sidebar #sidebar-nav-container {
      overflow-x: hidden;
    }

    #sidebar.neo-sidebar .nav-btn,
    #sidebar.neo-sidebar .submenu .nav-btn {
      box-sizing: border-box;
    }

    #sidebar.neo-sidebar .submenu {
      width: 100%;
    }

    /* Badges pulsantes */
    #sidebar.neo-sidebar .badge-pulse {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-left: auto;
      background: linear-gradient(90deg, rgba(59, 130, 246, .25), rgba(59, 130, 246, .15));
      color: #dbeafe;
      border: 1px solid rgba(59, 130, 246, .35);
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 600;
      position: relative;
    }

    #sidebar.neo-sidebar .badge-pulse::before {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: 999px;
      pointer-events: none;
      background: radial-gradient(circle, rgba(59, 130, 246, .25), transparent 60%);
      animation: pulseGlow 2s ease-in-out infinite;
    }

    @keyframes pulseGlow {

      0%,
      100% {
        opacity: .3;
        transform: scale(1);
      }

      50% {
        opacity: 1;
        transform: scale(1.05);
      }
    }

    /* Header superior alineado al sidebar (#111827) */
    #header-mobile {
      background: rgba(17, 24, 39, 0.9) !important;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    #header-mobile .font-bold,
    #header-mobile button,
    #header-mobile i {
      color: #e5e7eb !important;
    }

    /* Header horizontal (desktop) — estilo neo como el sidebar */
    #header-horizontal {
      position: sticky;
      top: 0;
      z-index: 1000;
      background: rgba(17, 24, 39, 0.9);
      backdrop-filter: blur(12px);
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }

    #header-horizontal::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: -50%;
      width: 200%;
      height: 3px;
      background: linear-gradient(90deg, transparent, #93c5fd 20%, #60a5fa 40%, #3b82f6 60%, #60a5fa 80%, transparent);
      animation: shimmer 2.2s infinite linear;
      opacity: .7;
    }

    #header-horizontal .hnav-container {
      max-width: 100%;
      width: 100%;
      margin: 0 auto;
      padding: .5rem 1rem;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 1rem;
    }

    #header-horizontal .hnav-user {
      justify-self: end;
      display: flex;
      align-items: center;
      gap: .5rem;
      color: #fff;
    }

    #header-horizontal #huser-info-avatar img {
      height: 28px;
      width: 28px;
      border-radius: 9999px;
      object-fit: cover;
    }

    #header-horizontal #huser-info-name {
      font-weight: 700;
      max-width: 160px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    #header-horizontal #huser-info-role {
      font-size: 11px;
      color: #9ca3af;
      text-transform: capitalize;
    }

    #header-horizontal #logout-btn-header.nav-btn {
      padding: .45rem .75rem;
    }

    #header-horizontal #logout-btn-header.nav-btn span {
      display: none;
    }

    /* ocultar texto en pantallas pequeñas */
    @media (min-width: 1024px) {
      #header-horizontal #logout-btn-header.nav-btn span {
        display: inline;
      }
    }

    #header-horizontal .brand {
      display: flex;
      align-items: center;
      gap: .6rem;
      color: #e5e7eb;
      font-weight: 700;
      letter-spacing: -0.015em;
    }

    #header-horizontal .brand img {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    }

    #header-horizontal nav.hnav {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: .25rem;
      width: 100%;
      overflow-x: auto;
      scrollbar-width: none;
      -ms-overflow-style: none;
    }

    #header-horizontal nav.hnav::-webkit-scrollbar {
      display: none;
    }

    /* Dropdowns horizontales */
    #header-horizontal .dropdown {
      position: relative;
    }

    #header-horizontal .group-chip-title .chev {
      margin-left: .4rem;
      opacity: .85;
      transition: transform .25s ease;
    }

    #header-horizontal .group-chip.collapsed .group-chip-title .chev {
      transform: rotate(0deg);
    }

    #header-horizontal .group-chip:not(.collapsed) .group-chip-title .chev {
      transform: rotate(180deg);
    }

    #header-horizontal .dropdown-menu {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      background: rgba(17, 24, 39, 0.98);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
      padding: .5rem;
      min-width: 260px;
      width: min(520px, calc(100vw - 32px));
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-auto-flow: row;
      align-items: stretch;
      justify-items: stretch;
      gap: .25rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-8px) scaleY(0.95);
      transform-origin: top;
      transition: transform .22s ease, opacity .22s ease, max-height .25s ease;
      max-height: 0;
      overflow: hidden;
      z-index: 1100;
    }

    /* Menú usuario con 1 columna */
    #header-horizontal .huser-menu .dropdown-menu {
      grid-template-columns: 1fr !important;
      min-width: 220px;
      width: auto;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu {
      opacity: 1;
      visibility: visible;
      transform: translateY(0) scaleY(1);
      max-height: 1000px;
      display: grid !important;
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    #header-horizontal .dropdown-menu .nav-btn {
      border-radius: 10px;
      justify-content: flex-start;
      width: 100%;
      box-sizing: border-box;
    }

    /* Animación escalonada de ítems del dropdown */
    #header-horizontal .dropdown-menu .nav-btn {
      opacity: 0;
      transform: translateY(-6px);
      transition: opacity .22s ease, transform .22s ease;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn {
      opacity: 1;
      transform: translateY(0);
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(1) {
      transition-delay: .02s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(2) {
      transition-delay: .04s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(3) {
      transition-delay: .06s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(4) {
      transition-delay: .08s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(5) {
      transition-delay: .10s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(6) {
      transition-delay: .12s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(7) {
      transition-delay: .14s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(8) {
      transition-delay: .16s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(9) {
      transition-delay: .18s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(10) {
      transition-delay: .20s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(11) {
      transition-delay: .22s;
    }

    #header-horizontal .dropdown:not(.collapsed) .dropdown-menu .nav-btn:nth-child(12) {
      transition-delay: .24s;
    }

    /* Botones horizontales con look & feel del sidebar */
    #header-horizontal .nav-btn {
      display: inline-flex;
      align-items: center;
      gap: .5rem;
      padding: .55rem .9rem;
      color: #ffffff;
      border-radius: 999px;
      position: relative;
      overflow: hidden;
      background: transparent;
      border: 1px solid transparent;
      transition: background-color 0.3s cubic-bezier(0.23, 1, 0.32, 1), transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    }

    #header-horizontal .nav-btn i {
      width: 18px;
      text-align: center;
      color: rgba(255, 255, 255, 0.92);
      transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    }

    #header-horizontal .nav-btn span {
      white-space: nowrap;
      font-weight: 500;
      letter-spacing: -0.01em;
    }

    #header-horizontal .nav-btn::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(37, 99, 235, 0.22));
      transform: translateX(-100%);
      transition: transform 0.3s ease;
      will-change: transform;
    }

    #header-horizontal .nav-btn:hover,
    #header-horizontal .nav-btn:hover span,
    #header-horizontal .nav-btn:hover i {
      color: #ffffff !important;
    }

    #header-horizontal .nav-btn:hover {
      background: rgba(255, 255, 255, 0.10);
      transform: translateY(-1px);
    }

    #header-horizontal .nav-btn:hover::before {
      transform: translateX(0);
    }

    #header-horizontal .nav-btn:hover i {
      transform: scale(1.06);
    }

    #header-horizontal .nav-btn.active {
      background: linear-gradient(90deg, rgba(255, 255, 255, 0.10), rgba(37, 99, 235, 0.28));
      color: #ffffff;
      border-color: rgba(37, 99, 235, 0.35);
      box-shadow: 0 4px 24px rgba(37, 99, 235, 0.35);
    }

    #header-horizontal .nav-btn.active::after {
      content: '';
      position: absolute;
      left: 12px;
      right: 12px;
      bottom: -1px;
      height: 3px;
      background: linear-gradient(90deg, #2563eb, #06b6d4);
      border-radius: 2px;
      box-shadow: 0 0 10px #2563eb;
    }

    /* Footer Moderno (estilos tomados y adaptados de modern_footer.html) */
    .footer {
      background: var(--sidebar-bg);
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      padding: 3rem 0 2rem;
      margin-top: auto;
      position: relative;
      overflow: hidden;
    }

    .footer::before {
      content: '';
      position: absolute;
      top: 0;
      left: -50%;
      width: 200%;
      height: 3px;
      background: linear-gradient(90deg, transparent, #93c5fd 20%, #60a5fa 40%, #3b82f6 60%, #60a5fa 80%, transparent);
      animation: shimmer 2.2s infinite linear;
    }

    @keyframes shimmer {
      0% {
        transform: translateX(-100%);
      }

      100% {
        transform: translateX(100%);
      }
    }

    .footer-container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 2rem;
      position: relative;
      z-index: 1;
    }

    .footer-content {
      display: grid;
      grid-template-columns: 2fr 1fr 1fr 1fr;
      gap: 3rem;
      margin-bottom: 2rem;
    }

    .footer-brand {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .footer-logo {
      font-size: 1.8rem;
      font-weight: 700;
      color: #60a5fa;
      position: relative;
      display: inline-block;
      overflow: hidden;
    }

    .footer-logo::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: -100%;
      width: 100%;
      height: 2px;
      background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd);
      transition: left 0.5s ease;
    }

    .footer-logo:hover::after {
      left: 0;
    }

    .footer-description {
      color: #9ca3af;
      line-height: 1.6;
      font-size: 0.95rem;
    }

    .footer-section h3 {
      color: #f3f4f6;
      font-size: 1rem;
      font-weight: 600;
      margin-bottom: 1.5rem;
      position: relative;
      overflow: hidden;
    }

    .footer-section h3::after {
      content: '';
      position: absolute;
      bottom: -8px;
      left: 0;
      width: 30px;
      height: 2px;
      background: linear-gradient(135deg, #3b82f6, #60a5fa);
      border-radius: 1px;
    }

    .footer-links {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.8rem;
    }

    .footer-links a {
      color: #9ca3af;
      text-decoration: none;
      font-size: 0.9rem;
      transition: all 0.3s ease;
      position: relative;
      padding: 0.2rem 0;
      display: block;
    }

    .footer-links a::before {
      content: '';
      position: absolute;
      left: -10px;
      top: 50%;
      transform: translateY(-50%);
      width: 4px;
      height: 4px;
      background: #60a5fa;
      border-radius: 50%;
      opacity: 0;
      transition: all 0.3s ease;
    }

    .footer-links a:hover {
      color: #60a5fa;
      transform: translateX(15px);
      text-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
    }

    .footer-links a:hover::before {
      opacity: 1;
      left: 0;
    }

    .social-links {
      display: flex;
      gap: 1rem;
      margin-top: 1.5rem;
    }

    .social-link {
      width: 45px;
      height: 45px;
      background: rgba(96, 165, 250, 0.1);
      border: 1px solid rgba(96, 165, 250, 0.3);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #9ca3af;
      text-decoration: none;
      font-size: 0.9rem;
      font-weight: bold;
      transition: all 0.35s ease;
      position: relative;
      overflow: hidden;
    }

    .social-link:hover {
      background: #60a5fa;
      color: #111827;
      transform: translateY(-8px) scale(1.1);
      box-shadow: 0 15px 35px rgba(96, 165, 250, 0.4), 0 5px 15px rgba(96, 165, 250, 0.2);
      border-color: #60a5fa;
    }

    .footer-bottom {
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      padding-top: 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 1rem;
    }

    .footer-copyright,
    .footer-legal a {
      color: #6b7280;
      font-size: 0.85rem;
    }

    .footer-legal {
      display: flex;
      gap: 2rem;
    }

    .footer-legal a {
      text-decoration: none;
      position: relative;
    }

    .footer-legal a::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: 0;
      width: 0;
      height: 1px;
      background: #60a5fa;
      transition: width 0.3s ease;
    }

    .footer-legal a:hover {
      color: #60a5fa;
    }

    .footer-legal a:hover::after {
      width: 100%;
    }

    @media (max-width: 900px) {
      .footer-content {
        grid-template-columns: 1fr 1fr;
      }
    }

    @media (max-width: 600px) {
      .footer-content {
        grid-template-columns: 1fr;
      }
    }

    /* Fix: sin margen y sin desbordamiento horizontal */
    html,
    body {
      height: 100%;
    }

    body {
      margin: 0;
      overflow-x: hidden;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    #app-container,
    #login-screen {
      flex: 1 0 auto;
    }

    /* Asegurar el footer ocupa el ancho completo y animacion de borde activa */
    .footer {
      width: 100%;
      position: relative;
      overflow: hidden;
      flex-shrink: 0;
    }

    .footer::before {
      content: '';
      position: absolute;
      top: 0;
      left: -50%;
      width: 200%;
      height: 3px;
      background: linear-gradient(90deg, transparent, #93c5fd 20%, #60a5fa 40%, #3b82f6 60%, #60a5fa 80%, transparent);
      animation: shimmer 2.2s infinite linear;
    }

    /* Clase dinamica para gradientes del banner principal configurables por el usuario */
    .dynamic-header-gradient {
      background: linear-gradient(to right, var(--header-grad-from, #0891b2), var(--header-grad-via, #2563eb), var(--header-grad-to, #0e7490)) !important;
    }

    /* Fix para prevenir que el footer flote sobre el header en paginas vacias */
    #main-content-wrapper {
      min-height: 85vh;
      /* Asegura un alto minimo para empujar el footer hacia abajo */
      z-index: 10;
    }

    #footer-modern-adapter,
    #app-footer {
      z-index: 40 !important;
      /* Menor que el header que suele ser z-50 */
      position: relative;
      margin-top: auto;
    }
  </style>
