* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --dark-bg: #000;
            --darker-bg: #0a0a0a;
            --card-bg: rgba(255, 255, 255, 0.05);
            --border-color: rgba(255, 255, 255, 0.1);
            --text-primary: #fff;
            --text-secondary: rgba(255, 255, 255, 0.8);
            --accent-color: #667eea;
            --research-color: #4ecdc4;
            --company-color: #f093fb;
            --timeline-color: #444;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--dark-bg);
            color: var(--text-primary);
            line-height: 1.6;
            overflow-x: auto;
        }

        /* Header */
        .header {
            padding: 2rem;
            text-align: center;
            background: radial-gradient(ellipse at center, rgba(102, 126, 234, 0.15) 0%, rgba(0, 0, 0, 1) 70%);
            border-bottom: 1px solid var(--border-color);
            position: relative;
        }

        .back-button {
            position: absolute;
            top: 2rem;
            left: 2rem;
            color: var(--text-primary);
            text-decoration: none;
            padding: 0.5rem 1rem;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            transition: all 0.3s ease;
            font-size: 1rem;
            backdrop-filter: blur(10px);
        }

        .back-button:hover {
            background: rgba(255, 255, 255, 0.2);
            border-color: var(--accent-color);
            transform: translateY(-1px);
        }

        .header h1 {
            font-size: clamp(2rem, 5vw, 3.5rem);
            font-weight: 800;
            margin-bottom: 1rem;
            background: linear-gradient(135deg, #fff 0%, #667eea 50%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .header p {
            font-size: 1.2rem;
            opacity: 0.8;
            max-width: 600px;
            margin: 0 auto;
        }

        /* Connection Status */
        .connection-status {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.8rem;
            z-index: 1000;
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .connection-status.connected {
            background: rgba(76, 175, 80, 0.2);
            border: 1px solid rgba(76, 175, 80, 0.4);
            color: #a5d6a7;
        }

        .connection-status.disconnected {
            background: rgba(255, 152, 0, 0.2);
            border: 1px solid rgba(255, 152, 0, 0.4);
            color: #ffcc02;
        }

        .login-btn {
            background: rgba(102, 126, 234, 0.3);
            border: 1px solid rgba(102, 126, 234, 0.6);
            color: #8fa7ff;
            padding: 0.3rem 0.8rem;
            border-radius: 15px;
            font-size: 0.7rem;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .login-btn:hover {
            background: rgba(102, 126, 234, 0.5);
            transform: translateY(-1px);
        }

        /* Login Modal */
        .login-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .login-form {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 15px;
            padding: 2rem;
            max-width: 400px;
            width: 90%;
            backdrop-filter: blur(20px);
        }

        .login-form h3 {
            margin-bottom: 1.5rem;
            text-align: center;
            background: linear-gradient(135deg, #fff 0%, #667eea 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .login-input {
            width: 100%;
            padding: 0.8rem;
            margin-bottom: 1rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-size: 0.9rem;
        }

        .login-input:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .login-buttons {
            display: flex;
            gap: 1rem;
            margin-top: 1rem;
        }

        .login-submit, .login-cancel {
            flex: 1;
            padding: 0.8rem;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.3s ease;
        }

        .login-submit {
            background: var(--primary-gradient);
            color: white;
        }

        .login-submit:hover {
            transform: translateY(-1px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
        }

        .login-cancel {
            background: rgba(255, 255, 255, 0.1);
            color: var(--text-secondary);
        }

        .login-cancel:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        /* Timeline Container */
        .timeline-container {
            padding: 3rem 2rem 2rem 2rem;
            min-height: calc(100vh - 300px);
            position: relative;
            overflow-x: auto;
            overflow-y: visible;
            margin-bottom: 2rem;
        }

        .timeline-wrapper {
            position: relative;
            width: max-content;
            min-width: 100%;
            height: 500px;
            margin: 0 auto;
            overflow: visible;
        }

        /* Main Timeline */
        .timeline {
            position: absolute;
            top: 200px;
            left: 100px;
            right: 100px;
            height: 4px;
            background: linear-gradient(90deg, var(--timeline-color) 0%, var(--accent-color) 50%, var(--timeline-color) 100%);
            border-radius: 2px;
            box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
            z-index: 1;
            pointer-events: none;
        }

        /* Year Markers */
        .year-marker {
            position: absolute;
            top: -35px;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-secondary);
            transform: translateX(-50%);
            white-space: nowrap;
            z-index: 3;
            pointer-events: none;
        }

        .year-marker.major {
            color: var(--accent-color);
            font-size: 1.1rem;
            font-weight: 700;
        }

        .year-marker::after {
            content: '';
            position: absolute;
            top: 40px;
            left: 50%;
            transform: translateX(-50%);
            width: 2px;
            height: 15px;
            background: currentColor;
            opacity: 0.5;
        }

        .year-marker.major::after {
            height: 25px;
            opacity: 1;
        }

        /* Month Markers */
        .month-marker {
            position: absolute;
            top: 10px;
            width: 1px;
            height: 8px;
            background: rgba(255, 255, 255, 0.2);
        }
        
        /* Month Markers for Expanded Years */
        .month-marker.expanded-year {
            height: 12px;
            background: rgba(102, 126, 234, 0.4);
            top: 8px;
        }
        
        .month-marker.month-label {
            font-size: 0.7rem;
            color: rgba(102, 126, 234, 0.8);
            background: none;
            width: auto;
            height: auto;
            top: -15px;
            left: -10px;
            text-align: center;
            font-weight: 500;
            pointer-events: none;
        }
        
        .month-marker.month-label::after {
            content: '';
            position: absolute;
            top: 25px;
            left: 10px;
            width: 1px;
            height: 12px;
            background: rgba(102, 126, 234, 0.6);
        }
        
        /* Marcadores ultra-densos para años con 15+ eventos */
        .month-marker.ultra-dense {
            height: 15px;
            background: linear-gradient(45deg, #667eea, #764ba2);
            top: 5px;
            box-shadow: 0 0 3px rgba(102, 126, 234, 0.3);
        }
        
        .month-marker.ultra-dense.month-label {
            color: #667eea;
            font-weight: 600;
            font-size: 0.6rem;
            text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
            top: -18px;
        }
        
        .month-marker.ultra-dense.month-label::after {
            height: 15px;
            background: linear-gradient(45deg, #667eea, #764ba2);
            box-shadow: 0 0 2px rgba(102, 126, 234, 0.4);
        }

        /* Event Cards */
        .event {
            position: absolute;
            width: 320px;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 15px;
            padding: 1.5rem;
            backdrop-filter: blur(15px);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            transform: translateX(-50%);
            z-index: 20;
            pointer-events: auto;
        }

        .event:hover {
            transform: translateX(-50%) translateY(-10px) scale(1.02);
            border-color: var(--accent-color);
            box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2);
            z-index: 100;
        }

        /* Bubble Mode */
        .event.bubble {
            width: 70px;
            height: 70px;
            padding: 0;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            overflow: hidden;
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
            pointer-events: auto;
            cursor: pointer;
        }

        .event.bubble .event-content {
            display: none;
        }

        .event.bubble .event-icon {
            margin: 0;
            font-size: 1.8rem;
        }

        .event.bubble:hover {
            width: 320px;
            height: auto;
            padding: 1.5rem;
            border-radius: 15px;
            font-size: 1rem;
            z-index: 200;
            overflow: visible;
            transform: translateX(-50%) translateY(-5px);
        }

        .event.bubble:hover .event-content {
            display: block;
            animation: fadeInContent 0.3s ease-out;
        }

        .event.bubble:hover .event-icon {
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }

        @keyframes fadeInContent {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .event.above {
            top: 100px;
        }

        .event.below {
            top: 250px;
        }

        /* Sistema de 4 niveles para evitar superposiciones */
        .event.above-high {
            top: 50px; /* Muy arriba */
        }

        .event.above-low {
            top: 100px; /* Arriba normal */
        }

        .event.below-high {
            top: 250px; /* Abajo normal */
        }

        .event.below-low {
            top: 300px; /* Muy abajo */
        }

        .event.research {
            border-left: 4px solid var(--research-color);
        }

        .event.company {
            border-left: 4px solid var(--company-color);
        }

        .event.research::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--research-color), transparent);
        }

        .event.company::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--company-color), transparent);
        }

        .event-icon {
            font-size: 2rem;
            margin-bottom: 0.5rem;
            text-align: center;
        }

        .event-date {
            font-size: 0.85rem;
            color: var(--accent-color);
            font-weight: 600;
            margin-bottom: 0.5rem;
        }

        .event-title {
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            color: var(--text-primary);
        }

        .event-description {
            font-size: 0.9rem;
            color: var(--text-secondary);
            line-height: 1.5;
            margin-bottom: 0.5rem;
        }

        .event-author {
            font-size: 0.8rem;
            color: var(--accent-color);
            font-style: italic;
        }

        .event-actions {
            display: none;
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            gap: 0.5rem;
        }

        .event:hover .event-actions {
            display: flex;
        }

        .event-btn {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            transition: all 0.3s ease;
        }

        .delete-btn {
            background: rgba(255, 107, 107, 0.8);
            color: white;
        }

        .delete-btn:hover {
            background: #ff6b6b;
            transform: scale(1.1);
        }

        .edit-btn {
            background: rgba(102, 126, 234, 0.8);
            color: white;
        }

        .edit-btn:hover {
            background: var(--accent-color);
            transform: scale(1.1);
        }

        /* Connection Lines */
        .connection-line {
            position: absolute;
            width: 2px;
            background: linear-gradient(180deg, var(--accent-color) 0%, var(--accent-color) 100%);
            left: 50%;
            transform: translateX(-50%);
            z-index: 2;
            opacity: 0.7;
            border-radius: 1px;
            pointer-events: none;
        }

        .connection-line.above {
            top: 135px;
            height: 65px;
        }

        .connection-line.below {
            top: 204px;
            height: 46px;
        }

        /* Líneas de conexión para sistema de 4 niveles */
        .connection-line.above-high {
            top: 85px; /* Conecta con evento muy arriba */
            height: 115px;
            background: linear-gradient(180deg, var(--accent-color) 0%, rgba(102, 126, 234, 0.7) 100%);
        }

        .connection-line.above-low {
            top: 135px; /* Conecta con evento arriba normal */
            height: 65px;
        }

        .connection-line.below-high {
            top: 204px; /* Conecta con evento abajo normal */
            height: 46px;
        }

        .connection-line.below-low {
            top: 204px; /* Conecta con evento muy abajo */
            height: 96px;
            background: linear-gradient(180deg, rgba(102, 126, 234, 0.7) 0%, var(--accent-color) 100%);
        }

        /* Control Panel */
        .control-panel {
            position: fixed;
            top: 50%;
            right: 2rem;
            transform: translateY(-50%);
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 15px;
            padding: 1.5rem;
            backdrop-filter: blur(15px);
            z-index: 100;
            min-width: 250px;
            transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }

        .control-panel.collapsed {
            right: -950px;
        }

        .panel-toggle {
            position: absolute;
            left: -40px;
            top: 50%;
            transform: translateY(-50%);
            width: 40px;
            height: 80px;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-right: none;
            border-radius: 15px 0 0 15px;
            backdrop-filter: blur(15px);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            writing-mode: vertical-rl;
            font-size: 0.8rem;
            color: var(--accent-color);
            font-weight: 600;
        }

        .panel-toggle:hover {
            background: var(--accent-color);
            color: white;
        }

        .control-panel h3 {
            margin-bottom: 1rem;
            color: var(--accent-color);
            font-size: 1.1rem;
        }

        .control-group {
            margin-bottom: 1.5rem;
        }

        .control-group label {
            display: block;
            margin-bottom: 0.5rem;
            font-size: 0.9rem;
            color: var(--text-secondary);
        }

        .control-input {
            width: 100%;
            padding: 0.8rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-size: 0.9rem;
        }

        .control-input:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }

        .control-btn {
            width: 100%;
            padding: 0.8rem;
            background: var(--primary-gradient);
            border: none;
            border-radius: 8px;
            color: white;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 0.5rem;
        }

        .control-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
        }

        .control-btn:disabled {
            background: rgba(255, 255, 255, 0.1);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .control-btn.secondary {
            background: rgba(255, 255, 255, 0.1);
        }

        .control-btn.danger {
            background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
        }

        /* Filters */
        .filter-options {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }

        .filter-btn {
            padding: 0.5rem 1rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 0.8rem;
        }

        .filter-btn.active {
            background: var(--accent-color);
            color: white;
            border-color: var(--accent-color);
        }

        /* Admin Section */
        .admin-section {
            border-top: 1px solid var(--border-color);
            margin-top: 1.5rem;
            padding-top: 1rem;
            display: none;
        }

        .admin-section.unlocked {
            display: block;
        }

        .admin-toggle {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 0.8rem;
        }

        .validation-error {
            color: #ff6b6b;
            font-size: 0.8rem;
            margin-top: 0.3rem;
            display: none;
        }

        /* Status Messages */
        .status-message {
            padding: 0.8rem;
            border-radius: 8px;
            margin-bottom: 1rem;
            font-size: 0.9rem;
            display: none;
        }

        .status-message.success {
            background: rgba(76, 175, 80, 0.2);
            border: 1px solid rgba(76, 175, 80, 0.4);
            color: #a5d6a7;
        }

        .status-message.error {
            background: rgba(244, 67, 54, 0.2);
            border: 1px solid rgba(244, 67, 54, 0.4);
            color: #ef9a9a;
        }

        .status-message.info {
            background: rgba(33, 150, 243, 0.2);
            border: 1px solid rgba(33, 150, 243, 0.4);
            color: #90caf9;
        }

        /* Statistics */
        .stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            margin: 2rem 0;
        }

        .stat-item {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: 15px;
            border: 1px solid var(--border-color);
            text-align: center;
        }

        .stat-number {
            font-size: 2rem;
            font-weight: 700;
            background: var(--primary-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .stat-label {
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-top: 0.5rem;
        }

        /* Legend */
        .legend {
            margin-top: 2rem;
            padding: 1.5rem;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 15px;
            backdrop-filter: blur(15px);
        }

        .legend h3 {
            margin-bottom: 1rem;
            color: var(--accent-color);
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 0.8rem;
            font-size: 0.9rem;
        }

        .legend-icon {
            font-size: 1.5rem;
        }

        .legend-line {
            width: 30px;
            height: 3px;
            border-radius: 2px;
        }

        .legend-line.research {
            background: var(--research-color);
        }

        .legend-line.company {
            background: var(--company-color);
        }

        /* Loading state */
        .loading {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 200px;
            font-size: 1.2rem;
            color: var(--text-secondary);
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 3px solid rgba(102, 126, 234, 0.3);
            border-top: 3px solid var(--accent-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-right: 1rem;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Responsive */
        @media (max-width: 1024px) {
            .control-panel {
                position: relative;
                right: auto;
                top: auto;
                transform: none;
                margin: 2rem auto;
                max-width: 90%;
            }
            
            .control-panel.collapsed {
                display: none;
            }
            
            .panel-toggle {
                display: none;
            }
            
            .timeline-container {
                padding: 2rem 1rem 2rem 1rem;
                min-height: calc(100vh - 400px);
            }
            
            .timeline-wrapper {
                height: 450px;
            }
            
            .timeline {
                top: 225px;
                left: 5%;
                right: 5%;
            }
            
            .event {
                width: min(280px, 80vw);
            }
            
            .event.above {
                top: 135px;
            }
            
            .event.below {
                top: 285px;
            }
            
            .connection-line.above {
                top: 170px;
                height: 55px;
            }
            
            .connection-line.below {
                top: 229px;
                height: 56px;
            }
            
            .event.bubble {
                width: 60px;
                height: 60px;
                font-size: 1.6rem;
            }
            
            .event.bubble .event-icon {
                font-size: 1.6rem;
            }
            
            .event.bubble:hover {
                width: min(280px, 80vw);
            }
        }

        @media (max-width: 768px) {
            .header {
                padding: 1.5rem 1rem;
            }
            
            .timeline-container {
                padding: 1.5rem 0.5rem 2rem 0.5rem;
                min-height: calc(100vh - 350px);
            }
            
            .timeline-wrapper {
                height: 400px;
            }
            
            .timeline {
                top: 200px;
                left: 3%;
                right: 3%;
            }
            
            .event {
                width: min(250px, 85vw);
                padding: 1rem;
                font-size: 0.9rem;
            }
            
            .event.above {
                top: 120px;
            }
            
            .event.below {
                top: 250px;
            }
            
            .connection-line.above {
                top: 155px;
                height: 45px;
            }
            
            .connection-line.below {
                top: 204px;
                height: 46px;
            }
            
            .event.bubble {
                width: 55px;
                height: 55px;
                font-size: 1.4rem;
            }
            
            .event.bubble .event-icon {
                font-size: 1.4rem;
            }
            
            .event.bubble:hover {
                width: min(250px, 85vw);
                padding: 1rem;
            }
        }

        /* Animation keyframes */
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateX(-50%) translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
        }

        .event.animate {
            animation: slideIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
        }